After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 161087 - g_get_language_names() should sort and eliminate duplicated codes
g_get_language_names() should sort and eliminate duplicated codes
Status: RESOLVED NOTABUG
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
: 604815 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-12-12 15:30 UTC by Christian Persch
Modified: 2011-09-22 18:56 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Christian Persch 2004-12-12 15:30:19 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.
Comment 1 Matthias Clasen 2004-12-13 04:36:03 UTC
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.

Comment 2 Owen Taylor 2004-12-13 16:24:51 UTC
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.

Comment 3 Christian Persch 2004-12-14 11:40:31 UTC
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 ?
Comment 4 Matthias Clasen 2004-12-14 13:15:55 UTC
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.
Comment 5 Dan Winship 2011-09-22 18:56:17 UTC
*** Bug 604815 has been marked as a duplicate of this bug. ***