Re: [newui] Populate the welcome spoke with translations

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

 



> +import babel

Don't forget to add python-babel to anaconda.spec.in.

> +def get_available_translations(domain=None, localedir=None):
> +    domain = domain or gettext._current_domain
> +    localedir = localedir or gettext._default_localedir
> +
> +    langdict = babel.Locale('en', 'US').languages
> +    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')
> +
> +    for langcode in languages:
> +        try:
> +            locale = babel.Locale.parse(langcode)
> +        except babel.core.UnknownLocaleError:
> +            continue
> +
> +        # some languages don't have a display_name
> +        display_name = locale.display_name or locale.english_name
> +        # some start with lowercase
> +        display_name = display_name.title()
> +
> +        yield Lang(langcode, locale.english_name, display_name)

This all looks really good.

> diff --git a/pyanaconda/ui/gui/spokes/welcome.py b/pyanaconda/ui/gui/spokes/welcome.py
> index c5d0e1d..1ebef96 100644
> --- a/pyanaconda/ui/gui/spokes/welcome.py
> +++ b/pyanaconda/ui/gui/spokes/welcome.py

Can you also update the apply method to change the current language to
whatever was selected?  I probably should have done that in the first
place, but it seemed silly when your choices were English or Languages
A-K.  Thanks.

- Chris

_______________________________________________
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