[PATCH 06/14] Allow seting up locale without modifying ksdata
Vratislav Podzimek
vpodzime at redhat.com
Wed Sep 25 17:27:49 UTC 2013
This is useful for switching between locales on the welcome screen to make
retranslate methods work and not modify ksdata with temporary values.
Related: rhbz#1006458
(cherry-picked 367e9ec8cbd4a743fa9c690cd180d96911314063 from master)
Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
pyanaconda/localization.py | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/localization.py b/pyanaconda/localization.py
index 94da80c..8218ea9 100644
--- a/pyanaconda/localization.py
+++ b/pyanaconda/localization.py
@@ -147,20 +147,23 @@ def is_supported_locale(locale):
en_name = get_english_name(locale)
return bool(en_name)
-def setup_locale(locale, lang):
+def setup_locale(locale, lang=None):
"""
Procedure setting the system to use the given locale and store it in to the
- ksdata.lang object. DOES NOT PERFORM ANY CHECKS OF THE GIVEN LOCALE.
+ ksdata.lang object (if given). DOES NOT PERFORM ANY CHECKS OF THE GIVEN
+ LOCALE.
:param locale: locale to setup
:type locale: str
- :param lang: ksdata.lang object
+ :param lang: ksdata.lang object or None
:return: None
:rtype: None
"""
- lang.lang = locale
+ if lang:
+ lang.lang = locale
+
os.environ["LANG"] = locale
def get_english_name(locale):
--
1.7.11.7
More information about the anaconda-patches
mailing list