GNOME Bugzilla – Bug 161087
g_get_language_names() should sort and eliminate duplicated codes
Last modified: 2011-09-22 18:56:17 UTC
g_get_language_names() should sort the codes so that more specific codes come first, and it should eliminate duplicate entries. Test program: #include <glib.h> int main (int argc, char ** argv) { g_print ("Languages: %s\n", g_strjoinv (" ", g_get_language_names ())); return 0; } For example: $ LANGUAGE=fr_FR:fr_CA:fr ./a.out fr_FR fr fr_CA fr fr C but I would prefer fr_FR fr_CA fr C so that I could use the output directly without having to sort the more specific codes first and to eliminate duplicates.
I don't think reordering the languages in this way is correct. Consider LANGUAGE=de:en_US. Reordering this would contradict the users preference for de.
Considering reordering more, if someone specified fr_FR:fr_CA Would they really want to prefer a fr_CA.po to a fr.po? I think reordering is basically always wrong. Though, actually, the question here of what is right is simple - it should correspond to whatever libintl/GNU libc does for LANGUAGE.
Re comment 2: I should have been more precise, I meant that sorting should also respect the order of the original list. So de:en_US expands to de,en_US,en which is fine. Re comment 3: _I_ would really want fr_FR:fr_CA to prefer fr_CA over fr. However you have a good point that it should be the same as the gettext behaviour. I've tested this, and it seems that glibc's gettext at least indeed does prefer fr over fr_CA if LANGUAGES=fr_FR:fr_CA. -> NOTABUG ?
I'm going to close this as NOTABUG then. It would be possible to strip duplicates, but I don't think its really worth it.
*** Bug 604815 has been marked as a duplicate of this bug. ***