Re: [PATCH 15/16] If we change language during Python, build the new locale files.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Looks good to me. The logic matches with what we have in loader.

--
Martin SivÃk
msivak@xxxxxxxxxx
Red Hat Czech
Anaconda team / Brno, CZ

----- Original Message -----
> We hit this on DVD installs (or if nopass is provided) since we
> completely
> skip loader's language selection screen.
> ---
> anaconda | 1 +
> pyanaconda/iw/language_gui.py | 1 +
> pyanaconda/kickstart.py | 1 +
> pyanaconda/language.py | 20 +++++++++++++++++++-
> pyanaconda/textw/language_text.py | 1 +
> 5 files changed, 23 insertions(+), 1 deletions(-)
> 
> diff --git a/anaconda b/anaconda
> index 32f6c0f..067750d 100755
> --- a/anaconda
> +++ b/anaconda
> @@ -883,6 +883,7 @@ if __name__ == "__main__":
> opts.lang = opts.lang.replace(".utf8", ".UTF-8")
> anaconda.dispatch.skipStep("language", permanent = 1)
> anaconda.instLanguage.instLang = opts.lang
> + anaconda.instLanguage.buildLocale()
> anaconda.instLanguage.systemLang = opts.lang
> anaconda.timezone.setTimezoneInfo(anaconda.instLanguage.getDefaultTimeZone(anaconda.rootPath))
> 
> diff --git a/pyanaconda/iw/language_gui.py
> b/pyanaconda/iw/language_gui.py
> index ef7124f..7bc771e 100644
> --- a/pyanaconda/iw/language_gui.py
> +++ b/pyanaconda/iw/language_gui.py
> @@ -50,6 +50,7 @@ class LanguageWindow (InstallWindow):
> 
> self.instLang.instLang = self.lang
> self.instLang.systemLang = self.lang
> + self.instLang.buildLocale()
> anaconda.timezone.setTimezoneInfo(anaconda.instLanguage.getDefaultTimeZone(anaconda.rootPath))
> self.ics.getICW().setLanguage()
> 
> diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
> index cf14899..764b940 100644
> --- a/pyanaconda/kickstart.py
> +++ b/pyanaconda/kickstart.py
> @@ -433,6 +433,7 @@ class Lang(commands.lang.FC3_Lang):
> def execute(self):
> self.anaconda.instLanguage.instLang = self.lang
> self.anaconda.instLanguage.systemLang = self.lang
> + self.anaconda.instLanguage.buildLocale()
> self.anaconda.ksdata.skipSteps.append("language")
> 
> class LogVolData(commands.logvol.F15_LogVolData):
> diff --git a/pyanaconda/language.py b/pyanaconda/language.py
> index 4de330c..2db6e4f 100644
> --- a/pyanaconda/language.py
> +++ b/pyanaconda/language.py
> @@ -21,6 +21,7 @@
> #
> 
> import os
> +import re
> import string
> import locale
> 
> @@ -31,8 +32,13 @@ import system_config_keyboard.keyboard as keyboard
> import logging
> log = logging.getLogger("anaconda")
> 
> +def langComponents(astring):
> + pattern =
> re.compile("(?P<language>[A-Za-z]+)(_(?P<territory>[A-Za-z]+))?(\.(?P<codeset>[-\w]+))?(@(?P<modifier>[-\w]+))?")
> + m = pattern.match(astring)
> + return m.groupdict()
> +
> # Converts a single language into a "language search path". For
> example,
> -# fr_FR.utf8@euro would become "fr_FR.utf8@eueo fr_FR.utf8 fr_FR fr"
> +# fr_FR.utf8@euro would become "fr_FR.utf8@euro fr_FR.utf8 fr_FR fr"
> def expandLangs(astring):
> langs = [astring]
> charset = None
> @@ -200,6 +206,18 @@ class Language(object):
> def available(self):
> return self.nativeLangNames.keys()
> 
> + def buildLocale(self):
> + import iutil
> +
> + c = langComponents(self._instLang)
> + locale_p = c["language"]
> + if c["territory"]:
> + locale_p += "_" + c["territory"]
> + if c["modifier"]:
> + locale_p += "@" + c["modifier"]
> +
> + iutil.execWithRedirect("localedef", ["-i", locale_p, "-f",
> c["codeset"] or "UTF-8", self._instLang])
> +
> def dracutSetupString(self):
> args=""
> 
> diff --git a/pyanaconda/textw/language_text.py
> b/pyanaconda/textw/language_text.py
> index 7cb86e8..1a36535 100644
> --- a/pyanaconda/textw/language_text.py
> +++ b/pyanaconda/textw/language_text.py
> @@ -63,6 +63,7 @@ class LanguageWindow:
> 
> anaconda.instLanguage.instLang = choice
> anaconda.instLanguage.systemLang = choice
> + anaconda.instLanguage.buildLocale()
> anaconda.timezone.setTimezoneInfo(anaconda.instLanguage.getDefaultTimeZone(anaconda.rootPath))
> 
> anaconda.intf.drawFrame()
> --
> 1.7.4.1
> 
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list



[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux