[Sugar-devel] [PATCH] CP: allow further selection beyond English fallback

Daniel Drake dsd at laptop.org
Fri Nov 23 13:11:02 EST 2012


Currently, the language control panel does not allow you to select
other languages after a en_US entry. This is built around the assumption
that source code strings are always in English, which is the common case,
but does not always have to be true.

As other apps can interpret the same LANGUAGE variable as a more general
priority list of languages (Maliit will start doing this), there is
further justification to remove the artificial en_US ending boundary.
---
 extensions/cpsection/language/view.py | 27 ---------------------------
 1 file changed, 27 deletions(-)

diff --git a/extensions/cpsection/language/view.py b/extensions/cpsection/language/view.py
index 95066f8..77f7207 100644
--- a/extensions/cpsection/language/view.py
+++ b/extensions/cpsection/language/view.py
@@ -136,8 +136,6 @@ class Language(SectionView):
             previous_add_removes = self._add_remove_boxes[-2]
             previous_add_removes.hide()
 
-        self._determine_add_remove_visibility()
-
         combobox.show()
 
     def _attach_to_table(self, widget, row, column, padding=20, \
@@ -216,8 +214,6 @@ class Language(SectionView):
         selected_langs = self._get_selected_langs()
         last_lang = selected_langs[-1]
 
-        self._determine_add_remove_visibility(last_lang=last_lang)
-
         self._changed = (selected_langs != self._selected_locales)
 
         if self._changed == False:
@@ -247,29 +243,6 @@ class Language(SectionView):
 
         return new_codes
 
-    def _determine_add_remove_visibility(self, last_lang=None):
-        # We should not let users add fallback languages for English (USA)
-        # This is because the software is not usually _translated_ into English
-        # which means that the fallback gets selected automatically
-
-        if last_lang is None:
-            selected_langs = self._get_selected_langs()
-            last_lang = selected_langs[-1]
-
-        add_remove_box = self._add_remove_boxes[-1]
-        buttons = add_remove_box.get_children()
-        add_button, remove_button = buttons
-
-        if last_lang.startswith('en_US'):
-            add_button.props.visible = False
-        else:
-            add_button.props.visible = True
-
-        if self._selected_lang_count == 1:
-            remove_button.props.visible = False
-        else:
-            remove_button.props.visible = True
-
     def __lang_timeout_cb(self, codes):
         self._lang_sid = 0
         self._model.set_languages_list(codes)
-- 
1.7.11.7



More information about the Sugar-devel mailing list