rename ravenlog to krowlog
There is a database named RavenDB. KrowLog starts with a K, which is a) distinctive and b) has an association to KDE.
This commit is contained in:
27
src/i18n.py
Normal file
27
src/i18n.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import gettext
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from src.pluginregistry import PluginRegistry
|
||||
from src.settings.settingsstore import SettingsStore
|
||||
|
||||
settings = SettingsStore.load()
|
||||
locale = os.environ['LANG'] if 'LANG' in os.environ and os.environ['LANG'] else "en"
|
||||
locale = settings.session.get('general', 'lang', fallback=locale)
|
||||
|
||||
_ = False
|
||||
src_dir = Path(__file__).resolve().parent.parent
|
||||
try:
|
||||
translation = gettext.translation('messages', localedir=src_dir / 'locales', languages=[locale])
|
||||
if translation:
|
||||
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