diff options
Diffstat (limited to 'recipes-installer/anaconda/files/0009-dynamic-detect-workable-locale.patch')
-rw-r--r-- | recipes-installer/anaconda/files/0009-dynamic-detect-workable-locale.patch | 58 |
1 files changed, 33 insertions, 25 deletions
diff --git a/recipes-installer/anaconda/files/0009-dynamic-detect-workable-locale.patch b/recipes-installer/anaconda/files/0009-dynamic-detect-workable-locale.patch index c7d9a2e..9e97018 100644 --- a/recipes-installer/anaconda/files/0009-dynamic-detect-workable-locale.patch +++ b/recipes-installer/anaconda/files/0009-dynamic-detect-workable-locale.patch @@ -6,29 +6,38 @@ Subject: [PATCH] dynamic detect workable locale Upstream-Status: Inappropriate [oe specific] Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> + +Refactor for anaconda 34. + +Signed-off-by: Kai Kang <kai.kang@windriver.com> + +Rebase for anaconda 37 on 20221020. + +Signed-off-by: Kai Kang <kai.kang@windriver.com> --- - pyanaconda/localization.py | 18 +++++++++++++++++- + pyanaconda/localization.py | 19 ++++++++++++++++++- pyanaconda/ui/gui/spokes/lib/lang_locale_handler.py | 2 ++ pyanaconda/ui/tui/spokes/language_support.py | 5 +++-- - 3 files changed, 22 insertions(+), 3 deletions(-) + 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/pyanaconda/localization.py b/pyanaconda/localization.py -index 20908ef..18d4be9 100644 +index 2331fa5b15..7c7c085397 100644 --- a/pyanaconda/localization.py +++ b/pyanaconda/localization.py -@@ -27,7 +27,7 @@ import glob - from collections import namedtuple +@@ -27,7 +27,7 @@ from collections import namedtuple + import functools - from pyanaconda.core import constants, util --from pyanaconda.core.util import upcase_first_letter, setenv, execWithRedirect -+from pyanaconda.core.util import upcase_first_letter, setenv, execWithRedirect, execReadlines + from pyanaconda.core import constants +-from pyanaconda.core.util import setenv, execWithRedirect ++from pyanaconda.core.util import setenv, execWithRedirect, execReadlines + from pyanaconda.core.string import upcase_first_letter + from pyanaconda.modules.common.constants.services import BOSS - from pyanaconda.anaconda_loggers import get_module_logger - log = get_module_logger(__name__) -@@ -776,3 +776,19 @@ def strip_codeset_and_modifier(locale): - if '.' in locale: - locale = locale[:locale.find('.')] - return locale +@@ -667,3 +667,20 @@ def setup_locale_environment(locale=None, text_mode=False, prefer_environment=Fa + for varname in ("LANGUAGE", "LC_ALL", "LC_MESSAGES"): + if varname in os.environ: + del os.environ[varname] ++ + +_all_locales = [] +def list_all_locales(): @@ -36,33 +45,33 @@ index 20908ef..18d4be9 100644 + + if _all_locales == []: + for lang in execReadlines("locale", ["-a"]): -+ parts= parse_langcode(lang) -+ locales = langtable.list_locales(languageId=parts["language"], -+ territoryId=parts.get("territory", ""), -+ scriptId=parts.get("script", "")) ++ parts = langtable.parse_locale(lang) ++ locales = langtable.list_locales(languageId=parts.language, ++ territoryId=parts.territory, ++ scriptId=parts.script) + _all_locales += locales + + log.info("all locales: %s" % _all_locales) + + return _all_locales diff --git a/pyanaconda/ui/gui/spokes/lib/lang_locale_handler.py b/pyanaconda/ui/gui/spokes/lib/lang_locale_handler.py -index 6380c14..c4e361b 100644 +index def8113df4..4e2ec18123 100644 --- a/pyanaconda/ui/gui/spokes/lib/lang_locale_handler.py +++ b/pyanaconda/ui/gui/spokes/lib/lang_locale_handler.py -@@ -166,6 +166,8 @@ class LangLocaleHandler(object): - locales = localization.get_language_locales(lang) - locales = self._filter_locales(lang, locales) +@@ -168,6 +168,8 @@ class LangLocaleHandler(object, metaclass=ABCMeta): for locale in locales: + if self._only_existing_locales and not localization.locale_has_translation(locale): + continue + if locale not in localization.list_all_locales(): + continue self._add_locale(self._localeStore, localization.get_native_name(locale), locale) diff --git a/pyanaconda/ui/tui/spokes/language_support.py b/pyanaconda/ui/tui/spokes/language_support.py -index f4e8f48..9a48a78 100644 +index 59c3596508..a046238429 100644 --- a/pyanaconda/ui/tui/spokes/language_support.py +++ b/pyanaconda/ui/tui/spokes/language_support.py -@@ -97,8 +97,9 @@ class LangSpoke(FirstbootSpokeMixIn, NormalTUISpoke): +@@ -107,8 +107,9 @@ class LangSpoke(FirstbootSpokeMixIn, NormalTUISpoke): if args: self.window.add(TextWidget(_("Available locales"))) for locale in args: @@ -76,4 +85,3 @@ index f4e8f48..9a48a78 100644 for lang in self._langs: -- 2.7.4 - |