pyARB
A localization library for python utilizing the ARB format for Flutter.
Usage
pyARB takes a primary .arb file and generates a python code equivalent.
pyarb l10ns [-h] [-e USE_EXISTING] arb_location [target_directory]
positional arguments:
arb_location The directory containing the arb files.
target_directory Location of the generated py file. Defaults to the directory above arb_location.
optional arguments:
-h, --help show this help message and exit
-e USE_EXISTING, --use-existing USE_EXISTING
Use existing arb files as locale list. You must specify the primary arb here
pyarb l10ns path/to/directory will prompt the user for a list of locales. The first in the list will be considered the primary locale and it will also be set as the fallback in case there is a problem with another locale. The primary .arb file must be present. If other locales are missing it will create the missing .arb file with the contents of the primary file. If a locale is already present then it will be left as it is to preserve translations already present in that file.
pyarb l10ns path/to/directory -e en_US will use the existing arb files as the list of allowed locales. It will use the specified locale as the primary locale, in this case: 'en_US'.
Example
Both of the above examples will create the generated_components.py file at path/to which you can then use in your code.
from path.to.generated_components import Translator, Lang
t = Translator(Lang.en_US)
print(t.followers_count(999950))
print(t.many_items("Bob", 10))
# Also supports static references
print(Translator.followers_count_static(Lang.es_ES, 6851651))
print(Translator.many_items_static(Lang.es_ES, "Juan", 3))
Docstrings are also provided to show what variables are needed for the translation key so your IDE can show you exactly what each localization is, what it needs, and what it will do.
A word on arb files
If you are not sure on how arb files are formatted read through the documentation found on localizely
Does not yet support
- DateTime and Object types in the .arb specification.
- The
compactLongformat for number types.
Metadata
Release files for pyARB 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyarb-1.2.0.tar.gz | 13.2 kB | Without provenance | Details for pyarb-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyarb-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for pyarb-1.2.0-py3-none-any.whl |
Total release size: 29.1 kB
Release files / pyarb-1.2.0.tar.gz
| Download URL | pyarb-1.2.0.tar.gz |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
362333654141d8cf7c262031bb13b7f912ce47932a6371b5260c7ae6f6b17726
|
|
BLAKE2b-256 checksum How to use checksums |
fbdf5736b2cf0347e60f6ead2e3156556522bc0e803284366852ab88d197108f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.13
|
Release files / pyarb-1.2.0-py3-none-any.whl
| Download URL | pyarb-1.2.0-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab35ab59dde70d5342af343b166514eda004dd04ddfd9a6c577e392c179408b6
|
|
BLAKE2b-256 checksum How to use checksums |
2e4dc0304c119c68ce25ec23a20e8732cd66f81a3f9d538c7db3d354da75d03d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.13
|
Security for pyARB 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.