-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2d3d9b
commit b462f2b
Showing
1 changed file
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,32 @@ | ||
# ez-localizr | ||
Simple tool for easily localizing Python scripts by reading strings from YAML files. | ||
|
||
ez-localizr is a simple tool for providing GUI/output translations for Python projects. It was originally developed to replace the need for i18n in a customTkinter GUI application. | ||
|
||
ez-localizr accounts for Unicode issues using `ftfy`, and loads string definitions from `yaml` files in a directory of your choice. See the example below to learn how to use it! | ||
|
||
## Installation: | ||
|
||
```pip install ez-localizr``` | ||
|
||
## Simple Usage Guide: | ||
|
||
```python | ||
L = ezlocalizr(language='en_US', string_path: 'strings', default_lang='en_US') | ||
|
||
text = L('test') | ||
|
||
print(text) | ||
``` | ||
Output: `Hello World!` | ||
|
||
## Change Languages: | ||
|
||
ez-localizr will only be able to display strings in languages that are in your string folder. If you have multiple, and would like to change it, call the `load_lang()` function. An example is listed below! | ||
|
||
```python | ||
L = ezlocalizr(language='en_US', string_path='strings', default_lang='en_US') | ||
|
||
L.load_lang('fr_FR') | ||
``` | ||
|
||
If you use this in tkinter, you will need to destroy the window and reinitialize it! (This is the best way I've discovered to update the display language of a GUI App.) |