|
Last change
on this file since 13478 was 7451, checked in by BPanther, 15 years ago |
|
[ipk] - copy source->source.sh4
|
|
File size:
889 bytes
|
| Line | |
|---|
| 1 | from Components.Language import language
|
|---|
| 2 | from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE
|
|---|
| 3 |
|
|---|
| 4 | import os,gettext
|
|---|
| 5 |
|
|---|
| 6 | PluginLanguageDomain = "CrossEPG"
|
|---|
| 7 | PluginLanguagePath = "SystemPlugins/CrossEPG/po"
|
|---|
| 8 |
|
|---|
| 9 | def localeInit():
|
|---|
| 10 | lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"
|
|---|
| 11 | os.environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!
|
|---|
| 12 | print "[CrossEPG] set language to ", lang
|
|---|
| 13 | gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(SCOPE_PLUGINS, PluginLanguagePath))
|
|---|
| 14 | gettext.bindtextdomain('enigma2', resolveFilename(SCOPE_LANGUAGE, ""))
|
|---|
| 15 |
|
|---|
| 16 | def _(txt):
|
|---|
| 17 | t = gettext.dgettext(PluginLanguageDomain, txt)
|
|---|
| 18 | if t == txt:
|
|---|
| 19 | #print "[CrossEPG] fallback to default translation for", txt
|
|---|
| 20 | t = gettext.dgettext('enigma2', txt)
|
|---|
| 21 | return t
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 | localeInit()
|
|---|
| 25 | language.addCallback(localeInit)
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.