[f18-alpha] [PATCH] Add UTF-8 enconding suffix to our language strings (#854688)

Chris Lumens clumens at redhat.com
Thu Sep 6 14:46:30 UTC 2012


> When using e.g. 'cs' as $LANG value, gettext tries to encode translated
> strings with latin-1 encoding which leads to tracebacks. Using 'cs.UTF-8'
> works.

This works for me and fixes a whole pile of bugs, but see my comments
below...

> @@ -133,9 +138,9 @@ def get_available_translations(domain=None, localedir=None):
>      messagefiles = gettext.find(domain, localedir, langdict.keys(), all=True)
>      languages = [path.split(os.path.sep)[-3] for path in messagefiles]
>  
> -    # usually there are no message files for en_US
> -    if 'en_US' not in languages:
> -        languages.append('en_US')
> +    # usually there are no message files for en
> +    if 'en' not in languages:
> +        languages.append('en')
>  
>      for langcode in languages:
>          try:

I already pushed a patch that does this.

> @@ -243,8 +248,8 @@ class Language(object):
>      def __init__(self, preferences={}, territory=None):
>          self.translations = {repr(locale):locale for locale in get_available_translations()}
>          self.locales = {repr(locale):locale for locale in get_all_locales()}
> -        self.preferred_translation = self.translations['en_US']
> -        self.preferred_locales = [self.locales['en_US']]
> +        self.preferred_translation = self.translations['en_US.UTF-8']
> +        self.preferred_locales = [self.locales['en_US.UTF-8']]
>          self.preferred_locale = self.preferred_locales[0]
>  
>          self.all_preferences = preferences

These will need to be "en.UTF-8".

- Chris


More information about the anaconda-patches mailing list