diff options
| author | Lex Neva <github.com@lexneva.name> | 2018-05-01 21:21:07 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2018-05-01 21:21:07 -0400 |
| commit | 05daffb7e01db55879eb24f3c00532324a5d41af (patch) | |
| tree | 43ff5d954e035e0e8b5a507b9c1bf9d6b4d3338d /lib/i18n.py | |
| parent | 1b31806423c8fec4040fed6d1009db016860b763 (diff) | |
refactor everything out of lib/__init__.py
Diffstat (limited to 'lib/i18n.py')
| -rw-r--r-- | lib/i18n.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/i18n.py b/lib/i18n.py new file mode 100644 index 00000000..d20f5d2f --- /dev/null +++ b/lib/i18n.py @@ -0,0 +1,21 @@ +import sys +import os +import gettext + +_ = translation = None + +def localize(): + if getattr(sys, 'frozen', False): + # we are in a pyinstaller installation + locale_dir = sys._MEIPASS + else: + locale_dir = os.path.dirname(__file__) + + locale_dir = os.path.join(locale_dir, 'locales') + + global translation, _ + + translation = gettext.translation("inkstitch", locale_dir, fallback=True) + _ = translation.gettext + +localize() |
