Locass - Simple and easy to use localization library written on Python
LoCalization As So Simple - simple, light-weight, and simple to use library which help you to localizate your apps on different languages.
Note: This project is unstable because of the first releases not tested. We are asking you to report any bugs you found.
How to use
Step 1: Create a folder with your localization files, for example locals.
We recommend you to create it in the root of your project or in the same directory with your executable because we recommend you to use RELATIVE paths like
./locals/
Step 2: Create localization files using your own markers or use default, markdown is:KEYMARKER(keyvalue)VALUEMARKER(value), consider that spaces between markers and values are forbidden. For example:
[k]HW![v]Привет Мир!
Step 3: Install and import this module in your project. Details about installing is on Installing page. Next, create a LocalManager object. Use expression like this:
man = locass.LocalManager()
Step 4: configure localization manager, using
man.configure()
function. First argument is the path, where your localization files are, for example "./locals/"
NOTE: Please, don't lose "/" symbols!
Second argument is the dictionary, which contains the localization name as a key and name of file as a value, for example {"RU": "ru.lang", "EN": "en.lang"}
Third is the Keymarker of your markdown you used in localization files, for example "[k]"
Last is the Valuemarker of your markdown, for example "[v]"
So if you used next markdown of localization flies:
file ru.lang in ./locals/ with inside
[k]HW![v]Привет Мир!
and file en.lang in the same directory with inside
[k]HW![v]Hello World!
your call will be like:
man.configure("./locals/",{"RU": "ru.lang", "EN":"en.lang"},"[k]","[v]")
Step 5: Load language to use, using loadLang(key) where key is localization name from previous step, for example "RU":
man.loadLang("RU")
Step 6: Use it in your code, and when you need string from selected localization, only call g(key), where key from your localization file. For example after steps above we can call next:
man.g("HW!") #Returns Привет Мир!
Note: To change the loaded language, only call loadLang again with new argument, for example
man2.configure("./locals/",{"RU": "ru.lang", "EN":"en.lang"},"[k]","[v]") man2.loadLang("RU") man2.g("HW!") #Returns Привет Мир! man2.loadLang("EN") man2.g("HW!") #Returns Hello World!
Installing
Get it form PyPi: https://pypi.org/project/locass/ or in terminal run
pip install locass
or
pip3 install locass
Tests
Try and see how the library works only running tests/test.py. Run it only after installing the library or it won't work.
Bugs and errors
Now library is under development so we asking you to tell us about every bug or error you found. You should consider that library is unstable and can cause some errors.
Metadata
Release files for locass 1.0.4
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 | |
|---|---|---|---|---|
| locass-1.0.4.tar.gz | 4.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| locass-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.4 kB
Release files / locass-1.0.4.tar.gz
| Download URL | locass-1.0.4.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e418cb97dd497758e504ab7f14881f224b8526ff054fdd6a59e09e0dc5fc506a
|
|
BLAKE2b-256 checksum How to use checksums |
99cef654d70a7d2bdc185de95f4a88a3a76013c0b66d9906121e326f5ef4ddfe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.8.13
|
Release files / locass-1.0.4-py3-none-any.whl
| Download URL | locass-1.0.4-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2047751aa51514fa8fe947dfe85a311e1c5669c7fd6e5377b6ed9d63ea6e2ad6
|
|
BLAKE2b-256 checksum How to use checksums |
48051cbb14cb42bfa9b9c3c5ea097edb0efd7013010e31bb99dceb49ec6b665d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.8.13
|
Security for locass 1.0.4
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.