1 # -*- coding: utf-8 -*-
2 # CurlyTx translation initialization
3 # Copyright (C) 2011 Christian Weiske <cweiske@cweiske.de>
5 from Components.Language import language
6 from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE
7 from os import environ as os_environ
11 """ Prepare settings for gettext usage """
12 lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"
13 os_environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!
14 gettext.bindtextdomain("CurlyTx", resolveFilename(SCOPE_PLUGINS, "Extensions/CurlyTx/locale"))
17 """ Custom gettext translation function that uses the CurlyTx domain """
18 t = gettext.dgettext("CurlyTx", txt)
20 #print "[CurlyTx] fallback to default translation for", txt
21 t = gettext.gettext(txt)
25 language.addCallback(localeInit)