base structure

This commit is contained in:
Maxim Khomutov 2025-03-23 01:40:02 +03:00
parent e481107444
commit b6ca2f7d7a
5 changed files with 40 additions and 1 deletions

View File

@ -1,3 +1,24 @@
# 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
View File

View File

@ -0,0 +1 @@
from .i18n import I18N

View File

@ -0,0 +1,4 @@
class I18N:
def __init__(self, lock_dir, load_lang):
pass

View 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