diff options
author | Jeremy Katz <katzj@redhat.com> | 2008-09-21 21:44:50 -0400 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2008-09-29 10:08:12 -0400 |
commit | fd524a44842007396056baf5e8ae8e76e0829634 (patch) | |
tree | 1f47e16a8859f2df63ced09178398449231c09da /scripts/getlangnames.py | |
parent | dbcf04d935a9be5754fc58369b2ecdd288b3c353 (diff) | |
download | anaconda-fd524a44842007396056baf5e8ae8e76e0829634.tar.gz anaconda-fd524a44842007396056baf5e8ae8e76e0829634.tar.xz anaconda-fd524a44842007396056baf5e8ae8e76e0829634.zip |
Fix lang-name generation + fix traceback with LANG=C
Generating lang-name depended on old behavior of rhpl.translate for looking
in po/ for the translation files. The regular gettext module doesn't do this
which means we don't get translated language names unless you already
had anaconda installed. So use gettext.GNUTranslation to directly open
the .mo file
For LANG=C, we need to ensure that the output charset is set to UTF-8
Diffstat (limited to 'scripts/getlangnames.py')
-rw-r--r-- | scripts/getlangnames.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/getlangnames.py b/scripts/getlangnames.py index 3189ca835..c63555097 100644 --- a/scripts/getlangnames.py +++ b/scripts/getlangnames.py @@ -21,15 +21,20 @@ import sys sys.path.append("..") import language -from constants import * import gettext -_ = lambda x: gettext.ldgettext("anaconda", x) langs = language.Language() names = {} for k in langs.localeInfo.keys(): - langs.setRuntimeLanguage(k) - names[langs.localeInfo[k][0]] = _(langs.localeInfo[k][0]) + for l in language.expandLangs(k): + try: + f = open("po/%s.mo" %(l,)) + except (OSError, IOError): + continue + cat = gettext.GNUTranslations(f) + cat.set_output_charset("utf-8") + names[langs.localeInfo[k][0]] = cat.lgettext(langs.localeInfo[k][0]) + break nameList = names.keys() nameList.sort() |