base structure
This commit is contained in:
parent
e481107444
commit
b6ca2f7d7a
21
README.md
21
README.md
@ -1,3 +1,24 @@
|
|||||||
# I18N-Module
|
# I18N-Module
|
||||||
|
|
||||||
Internationalization (i18n) module
|
Internationalization (i18n) module
|
||||||
|
|
||||||
|
i18n инжектися в builtins:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from internationalization import I18N
|
||||||
|
|
||||||
|
I18N("localization_dir", "en")
|
||||||
|
|
||||||
|
print(i18n['key'])
|
||||||
|
print(i18n.get_phrase('key', some=123))
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! luguru настроен под формат:
|
||||||
|
```python
|
||||||
|
fmt = "<green>{elapsed} -- {time:YYYY-MM-DD HH:mm:ss.SSS}</green> | <level>{level:<8}</level> | {extra[module]:^12} | {extra[prefix]:<12} | {message}"
|
||||||
|
```
|
||||||
|
|
||||||
|
Добавление в проект:
|
||||||
|
```bash
|
||||||
|
git submodule add ssh://git@git.anidev.ru:222/andiev-soft/I18N-Module src/modules/i18n
|
||||||
|
```
|
||||||
|
0
builtins.i18n.pyi.py
Normal file
0
builtins.i18n.pyi.py
Normal file
1
internationalization/__init__.py
Normal file
1
internationalization/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
from .i18n import I18N
|
4
internationalization/i18n.py
Normal file
4
internationalization/i18n.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
class I18N:
|
||||||
|
def __init__(self, lock_dir, load_lang):
|
||||||
|
pass
|
13
internationalization/utils.py
Normal file
13
internationalization/utils.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
def base_path():
|
||||||
|
# PyInstaller creates a temp folder and stores path in _MEIPASS
|
||||||
|
try:
|
||||||
|
# noinspection PyUnresolvedReferences,PyProtectedMember
|
||||||
|
return Path(sys._MEIPASS).resolve()
|
||||||
|
except AttributeError:
|
||||||
|
return Path().resolve()
|
||||||
|
|
||||||
|
def get_file(filename):
|
||||||
|
return base_path() / "resources" / filename
|
Loading…
x
Reference in New Issue
Block a user