There are often more translations for various language-territory combinations. E.g. en_US and en_GB or zh_TW and zh_CN etc.
Related: rhbz#1000715
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/localization.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/pyanaconda/localization.py b/pyanaconda/localization.py index 1997ac0..fc334b7 100644 --- a/pyanaconda/localization.py +++ b/pyanaconda/localization.py @@ -228,20 +228,21 @@ def get_available_translations(domain=None, localedir=None): messagefiles = sorted(glob.glob(localedir + "/*/LC_MESSAGES/anaconda.mo")) trans_gen = (path.split(os.path.sep)[-3] for path in messagefiles)
- # usually there are no message files for en - langs = {"en"} + yielded_locales = {"en_US.UTF-8"} yield "en_US.UTF-8"
for trans in trans_gen: parts = parse_langcode(trans) - lang = parts.get("language", "") - if lang and lang not in langs: - langs.add(lang) - locales = get_language_locales(lang) - if not locales: - continue - - # take the first locale (with highest rank) for the language + if not parts: + continue + + locales = get_language_locales(trans) + if not locales: + continue + + # take the first locale (with highest rank) for the language + if locales[0] not in yielded_locales: + yielded_locales.add(locales[0]) yield locales[0]
def get_language_locales(lang):
On Thu, 2013-08-29 at 15:18 -0400, David Shea wrote:
On 08/29/2013 08:18 AM, Vratislav Podzimek wrote:
# take the first locale (with highest rank) for the language
if locales[0] not in yielded_locales:
yielded_locales.add(locales[0]) yield locales[0]
Doesn't this need to yield every item in locales?
No, we offer only one locale (the best matching) for each translation. However, I'll send a set of patches completely reworking the welcome screen to offer all locales for all languages we have some translations for. This is a temporary quick fix as I expect the proper, more invasive solution to take time to be approved and tweaked.
On 08/30/2013 04:14 AM, Vratislav Podzimek wrote:
On Thu, 2013-08-29 at 15:18 -0400, David Shea wrote:
On 08/29/2013 08:18 AM, Vratislav Podzimek wrote:
# take the first locale (with highest rank) for the language
if locales[0] not in yielded_locales:
yielded_locales.add(locales[0]) yield locales[0]
Doesn't this need to yield every item in locales?
No, we offer only one locale (the best matching) for each translation. However, I'll send a set of patches completely reworking the welcome screen to offer all locales for all languages we have some translations for. This is a temporary quick fix as I expect the proper, more invasive solution to take time to be approved and tweaked.
Ah, ok. Ack.
anaconda-patches@lists.fedorahosted.org