locale-lib
This is a simple lib for localisation your services.
Installation
Installation is possible using the Python pip command line tool. For you the command to install this library may look like this:
pip3 install locale-lib
Usage
To use localisation package create instance of LocaleManager and get strings via property.
from locale_lib import LocaleManager
from datetime import datetime
locale_man = LocaleManager('./locales').setup() # FileNotFoundError if not found
locale = locale_man.get(input('enter your country code: '))
...
print(locale.greeting_message)
print(locale.f_time_now.format(time=datetime.now()))
./locales/locale_en:
greeting_message: hello, user!
f_time_now: Current datetime is:/ {time}
./locales/locale_es:
greeting_message: hola, usuario!
f_time_now: La fecha actual es:/ {time}
./locales/locale_ru:
greeting_message: Привет, пользователь!!
f_time_now: Сейчас:/ {time}
Tips
:must be replaced to:/(variable_name: value is:/ value)- To add new line use
\nin locale file locale.<string>(orlocale.get(<string>)) returning instance ofstrclass and might be formatted viaformat()method- Locale file should look like
locale_<country_code>.lc, other will be skipped
How it's meant to be used
- Standard strings should look like
var_name: Variable value - F-strings should look like
f_var_name: Variable {param_a} {param_d} {param_c} value
Metadata
Release files for locale-lib 1.0.3
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 | |
|---|---|---|---|---|
| locale_lib-1.0.3.tar.gz | 2.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| locale_lib-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.8 kB
Release files / locale_lib-1.0.3.tar.gz
| Download URL | locale_lib-1.0.3.tar.gz |
|---|---|
| Size | 2.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2fa583c75377ea6ac6ad5adf99119939176fa67847490af33fe2c24d889dee3a
|
|
BLAKE2b-256 checksum How to use checksums |
3410a30449ff14986eebff4dcd5f30a65c89a69fbb4eb44ad7aa610eda43899a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.1 Windows/10
|
Release files / locale_lib-1.0.3-py3-none-any.whl
| Download URL | locale_lib-1.0.3-py3-none-any.whl |
|---|---|
| Size | 2.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b043c510f5c9994d378b72ce039f9aa3aa318173fadca0c4a69baba61bda8c7
|
|
BLAKE2b-256 checksum How to use checksums |
056259cb8a917ffd5976383329589627994b2a4b0eda3512de99f2fe004ae141
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.1 Windows/10
|
Security for locale-lib 1.0.3
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.