fix file permissions of non-executable files
[enigma2-plugins.git] / networkwizard / src / __init__.py
1 from Components.Language import language\r
2 from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE\r
3 import os,gettext\r
4 PluginLanguageDomain = "NetworkWizard"\r
5 PluginLanguagePath = "SystemPlugins/NetworkWizard/po"\r
6 \r
7 def localeInit():\r
8         lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"\r
9         os.environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!\r
10         print "[NetworkWizard] set language to ", lang\r
11         gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(SCOPE_PLUGINS, PluginLanguagePath))\r
12         gettext.bindtextdomain('enigma2', resolveFilename(SCOPE_LANGUAGE, ""))\r
13 \r
14 def _(txt):\r
15         t = gettext.dgettext(PluginLanguageDomain, txt)\r
16         if t == txt:\r
17                 print "[NetworkWizard] fallback to default translation for", txt\r
18                 t = gettext.dgettext('enigma2', txt)\r
19         return t\r
20 \r
21 \r
22 localeInit()\r
23 language.addCallback(localeInit)