2021-02-09 12:20:42 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
from __future__ import print_function
|
|
|
|
|
from Components.Language import language
|
|
|
|
|
from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE
|
2021-04-14 00:13:41 +04:30
|
|
|
import os
|
|
|
|
|
import gettext
|
2021-02-09 12:20:42 +02:00
|
|
|
PluginLanguageDomain = 'NeoBoot'
|
|
|
|
|
PluginLanguagePath = 'Extensions/NeoBoot/locale'
|
|
|
|
|
|
2021-04-14 00:13:51 +04:30
|
|
|
|
2021-02-09 12:20:42 +02:00
|
|
|
def localeInit():
|
|
|
|
|
lang = language.getLanguage()[:2]
|
|
|
|
|
os.environ['LANGUAGE'] = lang
|
2021-04-14 00:13:46 +04:30
|
|
|
print("[NeoBoot] set language to "), lang
|
2021-02-09 12:20:42 +02:00
|
|
|
gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(SCOPE_PLUGINS, PluginLanguagePath))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _(txt):
|
|
|
|
|
t = gettext.dgettext(PluginLanguageDomain, txt)
|
|
|
|
|
if t == txt:
|
2021-04-14 00:13:46 +04:30
|
|
|
print("[NeoBoot] fallback to default translation for"), txt
|
2021-02-09 12:20:42 +02:00
|
|
|
t = gettext.dgettext('enigma2', txt)
|
|
|
|
|
return t
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
localeInit()
|
|
|
|
|
language.addCallback(localeInit)
|