make equal name/title another requirement for avoidDuplicateDescription
[vuplus_dvbapp-plugin] / networkbrowser / src / __init__.py
1 # -*- coding: ISO-8859-1 -*-
2 #===============================================================================
3 # NetworkBrowser and MountManager Plugin by acid-burn
4 # netscan lib by Nix_niX
5 # for further License informations see the corresponding License files
6 # or SourceCodes
7 #
8 #===============================================================================
9
10 from Components.Language import language
11 from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE
12 import os,gettext
13 PluginLanguageDomain = "NetworkBrowser"
14 PluginLanguagePath = "SystemPlugins/NetworkBrowser/po"
15
16 def localeInit():
17         lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"
18         os.environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!
19         print "[NetworkBrowser] set language to ", lang
20         gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(SCOPE_PLUGINS, PluginLanguagePath))
21
22 def _(txt):
23         t = gettext.dgettext(PluginLanguageDomain, txt)
24         if t == txt:
25                 print "[NetworkBrowser] fallback to default translation for", txt
26                 t = gettext.gettext(txt)
27         return t
28
29 localeInit()
30 language.addCallback(localeInit)