gst-plugin-dreamsource: update srcrev and switch to opendreambox_srcrev to allow...
[opendreambox.git] / meta-opendreambox / recipes-dreambox / enigma2 / enigma2-4.2.1.13-dm7080 / 0002-Components-Language.py-revert-change-of-existing-key.patch
1 From ef1ec031c56aee2ecc05e6d6a19f7254e78b7f53 Mon Sep 17 00:00:00 2001
2 From: reichi <reichi@opendreambox.org>
3 Date: Tue, 27 Jan 2015 16:31:19 +0100
4 Subject: [PATCH 1/2] Components/Language.py: revert change of existing keys in
5  langlist items. use additional (configurable) tuple element for calling
6  locale.setlocale with the correct key
7
8 ---
9  usr/lib/enigma2/python/Components/Language.py | 19 +++++++++++--------
10  1 file changed, 11 insertions(+), 8 deletions(-)
11
12 diff --git a/usr/lib/enigma2/python/Components/Language.py b/usr/lib/enigma2/python/Components/Language.py
13 index ef201bb..61efd70 100644
14 --- a/usr/lib/enigma2/python/Components/Language.py
15 +++ b/usr/lib/enigma2/python/Components/Language.py
16 @@ -15,10 +15,10 @@ class Language:
17                 # FIXME make list dynamically
18                 # name, iso-639 language, iso-3166 country. Please don't mix language&country!
19                 # also, see "precalcLanguageList" below on how to re-create the language cache after you added a language
20 -               self.addLanguage(_("English"), "en", "GB")
21 +               self.addLanguage(_("English"), "en", "EN", "en_GB")
22                 self.addLanguage(_("German"), "de", "DE")
23                 self.addLanguage(_("Arabic"), "ar", "AE")
24 -               self.addLanguage(_("Brazilian Portuguese"), "pt_BR", "BR")
25 +               self.addLanguage(_("Brazilian Portuguese"), "pt_BR", "BR", "pt_BR")
26                 self.addLanguage(_("Catalan"), "ca", "AD")
27                 self.addLanguage(_("Croatian"), "hr", "HR")
28                 self.addLanguage(_("Czech"), "cs", "CZ")
29 @@ -46,13 +46,15 @@ class Language:
30                 self.addLanguage(_("Swedish"), "sv", "SE")
31                 self.addLanguage(_("Turkish"), "tr", "TR")
32                 self.addLanguage(_("Ukrainian"), "uk", "UA")
33 -               self.addLanguage(_("Frisian"), "fy", "NL") # there is no separate country for frisian
34 +               self.addLanguage(_("Frisian"), "fy", "x-FY", "fy_NL") # there is no separate country for frisian
35  
36                 self.callbacks = []
37  
38 -       def addLanguage(self, name, lang, country):
39 +       def addLanguage(self, name, lang, country, code=None):
40                 try:
41 -                       self.lang[str(lang + "_" + country)] = ((_(name), lang, country))
42 +                       if code is None:
43 +                               code = "%s_%s" %(lang, country)
44 +                       self.lang[str(lang + "_" + country)] = ((_(name), lang, country, code))
45                         self.langlist.append(str(lang + "_" + country))
46                 except:
47                         print "Language " + str(name) + " not found"
48 @@ -64,9 +66,10 @@ class Language:
49                         gettext._translations = {}
50                         self.currLangObj = gettext.translation('enigma2', resolveFilename(SCOPE_LANGUAGE, ""), languages=[lang[1]], fallback=True)
51                         self.currLangObj.install(names="ngettext")
52 -                       os.environ["LANGUAGE"] = lang[1]
53 -                       lc = lang[1] if "_" in lang[1] else "%s_%s" %(lang[1], lang[2]) #HACK for pt_BR
54 -                       locale.setlocale(locale.LC_TIME, lc)
55 +                       try:
56 +                               locale.setlocale(locale.LC_TIME, lang[3])
57 +                       except Exception, e:
58 +                               print "Error settings system language, date/time will not be translated %s" %(e)
59                         self.activeLanguage = index
60                         self.activateLanguageFallback(index, 'enigma2-plugins' )
61                 except:
62 -- 
63 1.9.1
64