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:
2022-02-12 10:22:47 +01:00
parent 38e14d6042
commit a640b35c87
62 changed files with 380 additions and 362 deletions

27
src/i18n.py Normal file
View 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')