diff --git a/tiramisu/i18n.py b/tiramisu/i18n.py index c872da7..756a1c0 100644 --- a/tiramisu/i18n.py +++ b/tiramisu/i18n.py @@ -24,6 +24,9 @@ from pkg_resources import resource_filename from .log import log +DEFAULT = 'en' + + def get_translation() -> str: """Sets the user locale as langage The default is set to english @@ -40,11 +43,14 @@ def get_translation() -> str: from locale import getdefaultlocale default_locale = getdefaultlocale() if default_locale and isinstance(default_locale, tuple): - user_locale = default_locale[0][:2] + if default_locale[0] is not None: + user_locale = default_locale[0][:2] + else: + user_locale = DEFAULT elif default_locale: user_locale = default_locale[:2] else: - user_locale = 'en' + user_locale = DEFAULT try: trans = translation(domain=app_name, localedir=translations_path,