force lang in env

This commit is contained in:
Emmanuel Garette 2022-02-06 18:00:59 +01:00
parent 7764fa9b43
commit 49f1cda4d3

View file

@ -18,10 +18,12 @@
# the rough gus of pypy: pypy: http://codespeak.net/svn/pypy/dist/pypy/config/ # the rough gus of pypy: pypy: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence # the whole pypy projet is under MIT licence
"internationalisation utilities" "internationalisation utilities"
from .log import log
from gettext import translation, NullTranslations from gettext import translation, NullTranslations
from platform import system from platform import system
from pkg_resources import resource_filename from pkg_resources import resource_filename
from .log import log from os import environ
DEFAULT = 'en' DEFAULT = 'en'
@ -35,6 +37,9 @@ def get_translation() -> str:
app_name = __name__[:-5] app_name = __name__[:-5]
translations_path = resource_filename(app_name, 'locale') translations_path = resource_filename(app_name, 'locale')
if 'TIRAMISU_LOCALE' in environ:
user_locale = environ['TIRAMISU_LOCALE']
else:
if 'Windows' in system(): if 'Windows' in system():
import ctypes import ctypes
from locale import windows_locale from locale import windows_locale