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

Re: [Libosinfo] [PATCH 2/2] win7,installer: 'FR-CA' not supported



On Wed, May 14, 2014 at 03:48:52PM +0100, Zeeshan Ali (Khattak) wrote:
> I think Boxes should choose the first supported lang on the media (if
> media has any lang associated) rather than system lang when it fails
> to match the lang from system and media. Wouldn't you agree?

My understanding of UnattendedInstaller::get_preferred_language() is
that it's already doing that:

    private string get_preferred_language () {
        var system_langs = Intl.get_language_names ();
        var media_langs = new HashTable<string, unowned string> (str_hash, str_equal);
        var media_langs_list = os_media.languages;

        foreach (var lang in media_langs_list)
            media_langs.add (lang);

        foreach (var lang in system_langs) {

==> here we should probably strip .UTF-8 from lang as is done below

            if (lang in media_langs) {
                debug ("matched %s", lang);
                return lang;
            }
        }

==> media language fallback below

        if (media_langs_list != null) {
            debug ("Failed to match system locales with media languages, falling back to %s media language",
                   media_langs_list.nth_data (0));
            return media_langs_list.nth_data (0);
        }

==> system locale fallback below

        var lang = system_langs[0].replace (".utf8", "");
        lang = lang.replace (".UTF-8", "");
        debug ("No media language, using %s locale", lang);

        return lang;
    }


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