ability to change language
This commit is contained in:
@@ -2,11 +2,14 @@ import gettext
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from raven.pluginregistry import PluginRegistry
|
||||
from settingsstore import SettingsStore
|
||||
|
||||
settings = SettingsStore.load()
|
||||
locale = os.environ['LANG'] if os.environ['LANG'] else "en"
|
||||
print("locale1: %s" % locale)
|
||||
locale = settings.session.get('general', 'lang', fallback=locale)
|
||||
print("locale2: %s" % locale)
|
||||
|
||||
_ = False
|
||||
src_dir = Path(__file__).resolve().parent.parent
|
||||
@@ -16,9 +19,11 @@ try:
|
||||
translation.install()
|
||||
_ = translation.gettext
|
||||
ngettext = translation.ngettext
|
||||
PluginRegistry.execute("set_locale", locale)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
if not _:
|
||||
_ = gettext.gettext
|
||||
ngettext = gettext.ngettext
|
||||
PluginRegistry.execute("set_locale", '')
|
||||
print('No translation found')
|
||||
|
||||
Reference in New Issue
Block a user