A lightweight library for handling translations via the Locize API
Project description
Simple Locize
Simple Locize is a library for handling translations via the Locize API. Locize is a translation management system that allows you to easily manage your application's translations.
Installation
pip install simple-locize
Usage
To use Simple Locize, you first need to create an instance of the SimpleLocize class:
from simple_locize import SimpleLocize
project_id = 'your-project-id'
environment = 'your-environment'
private_key = 'your-private-key' # optional
locize = SimpleLocize(project_id, environment, private_key)
Fetching translations
To fetch translations for a specific namespace and language, you can use the get_all_translations_from_namespace method:
namespace = 'your-namespace'
language = 'en'
translations = locize.get_all_translations_from_namespace(namespace, language)
This will return an object containing all translations for the specified namespace and language.
Translating a key
To translate a specific key for a namespace and language, you can use the translate method:
namespace = 'your-namespace'
language = 'en'
key = 'your.key'
translation = locize.translate(namespace, language, key)
This will return the translation for the specified key, or the key itself if no translation is found.
License
Simple Locize is open-sourced software licensed under the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simple_locize-1.0.1.tar.gz.
File metadata
- Download URL: simple_locize-1.0.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7aac8e31b632adfe2673312675728d343db2bdaf7b52ac26772b12ceed5bfe1
|
|
| MD5 |
614d304d3d10c5d630aa5370ed579fe0
|
|
| BLAKE2b-256 |
95cf37d4e4cbba50bb924d72af30cb12eb16cebb63aa6d9e24350170abf9d4c8
|
File details
Details for the file simple_locize-1.0.1-py3-none-any.whl.
File metadata
- Download URL: simple_locize-1.0.1-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
642da3fdff8f337f2b0f2f32f577bdd72e07bdbba3f6d52edc917d34dde508e2
|
|
| MD5 |
02a4c0e8ddb4c6d8567ce2272ea5a6da
|
|
| BLAKE2b-256 |
6ecf3399feee6bd98bfd9040707e037bca95a0d98cebbe88a05b4ca90929f1cd
|