When allowing multiples language to be set we broke the
support to set a language by a command line command.
This patch does revert that functionality.
---
 extensions/cpsection/language/model.py |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/extensions/cpsection/language/model.py 
b/extensions/cpsection/language/model.py
index 48bb496..ab1e25a 100644
--- a/extensions/cpsection/language/model.py
+++ b/extensions/cpsection/language/model.py
@@ -67,9 +67,7 @@ def _initialize():
                                            lang[1].replace(' ', '_'))
 
 
-def _write_i18n(langs):
-    colon = ':'
-    langstr = colon.join(langs)
+def _write_i18n(lang_env, language_env):
     path = os.path.join(os.environ.get('HOME'), '.i18n')
     if not os.access(path, os.W_OK):
         print _standard_msg
@@ -79,8 +77,8 @@ def _write_i18n(langs):
         fd.close()
     else:
         fd = open(path, 'w')
-        fd.write('LANG="%s"\n' % langs[0].strip("\n"))
-        fd.write('LANGUAGE="%s"\n' % langstr)
+        fd.write('LANG="%s"\n' % lang_env)
+        fd.write('LANGUAGE="%s"\n' % language_env)
         fd.close()
 
 
@@ -139,7 +137,7 @@ def set_languages(languages):
         # This came from the commandline
         #TODO: Support multiple languages from the command line
         if languages.endswith('utf8'):
-            _write_i18n(languages)
+            _write_i18n(languages, languages)
             return 1
         else:
             langs = read_all_languages()
@@ -147,11 +145,14 @@ def set_languages(languages):
                 code = lang.replace(' ', '_') + '/' \
                         + territory.replace(' ', '_')
                 if code == languages:
-                    _write_i18n(locale)
+                    _write_i18n(locale, locale)
                     return 1
             print (_("Sorry I do not speak \'%s\'.") % languages)
     else:
-        _write_i18n(languages)
+        colon = ':'
+        language_env = colon.join(languages)
+        lang_env = languages[0].strip('\n')
+        _write_i18n(lang_env, language_env)
 
 
 # inilialize the docstrings for the language
-- 
1.7.4

_______________________________________________
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel

Reply via email to