Re: [PATCH] Set default lang and create default locale files early

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

 



ack

----- Original Message -----
> If you import locale before the file(s) get created, you end up with
> a
> traceback from locale that says:
> 
>   Error: unsupported locale setting
> 
> And this happens no matter what the locale is.
> 
> We used to create the locale files for the default lang in loader, so
> now let's have anaconda declare a default locale and build its locale
> data before we import locale.
> ---
>  anaconda                |    7 ++++++-
>  pyanaconda/constants.py |    3 +++
>  pyanaconda/language.py  |    6 +++---
>  3 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/anaconda b/anaconda
> index 0094ef9..a123bee 100755
> --- a/anaconda
> +++ b/anaconda
> @@ -614,7 +614,7 @@ if __name__ == "__main__":
>  
>      # pull this in to get product name and versioning
>      from pyanaconda import product
> -    from pyanaconda.constants import ROOT_PATH
> +    from pyanaconda.constants import ROOT_PATH, DEFAULT_LANG
>  
>      from pyanaconda import isys
>      isys.initLog()
> @@ -625,6 +625,11 @@ if __name__ == "__main__":
>      from pyanaconda import vnc
>      from pyanaconda import kickstart
>  
> +    # Write out the default locale before anything imports locale
> (#731356)
> +    deflang, defcode = DEFAULT_LANG.split('.')
> +    iutil.execWithRedirect("localedef",
> +                           ["-i", deflang, "-f", defcode,
> DEFAULT_LANG])
> +
>      import gettext
>      _ = lambda x: gettext.ldgettext("anaconda", x)
>  
> diff --git a/pyanaconda/constants.py b/pyanaconda/constants.py
> index 4167f96..9ceeb9b 100644
> --- a/pyanaconda/constants.py
> +++ b/pyanaconda/constants.py
> @@ -87,3 +87,6 @@ relabelDirs  = ["/etc/sysconfig/network-scripts",
> "/var/lib/rpm", "/var/lib/yum"
>  
>  ANACONDA_CLEANUP = "anaconda-cleanup"
>  ROOT_PATH = "/mnt/sysimage"
> +
> +# NOTE: this should be LANG.CODESET, e.g. en_US.UTF-8
> +DEFAULT_LANG = "en_US.UTF-8"
> diff --git a/pyanaconda/language.py b/pyanaconda/language.py
> index cb90085..f49c041 100644
> --- a/pyanaconda/language.py
> +++ b/pyanaconda/language.py
> @@ -26,7 +26,7 @@ import string
>  import locale
>  
>  import gettext
> -from pyanaconda.constants import ROOT_PATH
> +from pyanaconda.constants import ROOT_PATH, DEFAULT_LANG
>  import localeinfo
>  from simpleconfig import SimpleConfigFile
>  import system_config_keyboard.keyboard as keyboard
> @@ -51,7 +51,7 @@ class Language(object):
>              self._instLang = value
>  
>          # If we're running in text mode, value may not be a
>          supported language
> -        # to display.  We need to default to en_US.UTF-8 for now.
> +        # to display.  Fall back to the default for now.
>          if self.displayMode == 't':
>              for (lang, info) in self.localeInfo.iteritems():
>                  if lang == self._instLang and info[2] == "False":
> @@ -117,7 +117,7 @@ class Language(object):
>      systemLang = property(lambda s: s._systemLang, lambda s, v:
>      s._setSystemLang(v))
>  
>      def __init__ (self, display_mode = 'g'):
> -        self._default = "en_US.UTF-8"
> +        self._default = DEFAULT_LANG
>          self.displayMode = display_mode
>          self.info = {}
>          self.nativeLangNames = {}
> --
> 1.7.7.6
> 
> _______________________________________________
> 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