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 169329 - locale prioritisation broken for mime type descriptions
locale prioritisation broken for mime type descriptions
Status: RESOLVED FIXED
Product: gnome-vfs
Classification: Deprecated
Component: MIME and file/program mapping
cvs (head)
Other All
: Normal normal
: ---
Assigned To: gnome-vfs maintainers
gnome-vfs maintainers
Depends on:
Blocks:
 
 
Reported: 2005-03-05 20:58 UTC by Allison Karlitskaya (desrt)
Modified: 2005-04-04 02:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
mwah. (5.94 KB, patch)
2005-03-05 20:58 UTC, Allison Karlitskaya (desrt)
none Details | Review

Description Allison Karlitskaya (desrt) 2005-03-05 20:58:25 UTC
1: have en_CA as your locale
2: go into /usr/share/mime/application/octet-stream.xml

add these lines:
  <comment xml:lang="en_CA">correct</comment>
  <comment xml:lang="en">incorrect</comment>

3: restart nautilus
4: create an empty file
5: go into properties to see "Type: incorrect"

This is caused by the language_level function in gnome-vfs-mime-info.c and 
gnome-vfs-application-registry.c working opposite to how they are documented.

/* this gives us a number of the language in the current language list,
   the higher the number the "better" the translation */

Really, the function returns lower numbers for better results.  The attached
patch modifies the two uses of this function to behave correctly.

Additionally, language_level requires a global variable current_lang to be set.
 This variable is set from calling gnome_vfs_i18n_get_language_list which in
turn calls bonobo_activation_i18n_get_language_list.  This function isn't in any
header file (gnome-vfs uses it by prototyping it for itself).  Calling this
function is deprecated since it causes 100k of anonymous memory to be
permanently allocated per process.

The patch also modifies get_language_list to use g_get_language_names() instead
and removes the use of the global variable.  See bug 168948 for more information.
Comment 1 Allison Karlitskaya (desrt) 2005-03-05 20:58:46 UTC
Created attachment 38315 [details] [review]
mwah.
Comment 2 Christophe Fergeau 2005-03-07 08:45:20 UTC
Removing gnome_vfs_i18n_get_language_list was something I had in mind for 2.12,
you beat me to it ;) It can't go in before 2.10 though, maybe your patch would
be good for 2.10.1. 

@@ -639,7 +638,7 @@
 	    /* our language level really sucks and the previous
 	       translation was of better language quality so just
 	       ignore us */
-	    previous_key_lang_level > lang_level) {
+	    previous_key_lang_level < lang_level) {
 		return;
 	}

Is this hunk enough to fix the bug initially described in this report? 
Comment 3 Allison Karlitskaya (desrt) 2005-03-07 12:49:17 UTC
iirc, this is the right chunk to fix that:

@@ -338,7 +341,7 @@
 	MimeEntry *entry;
 	int ret;
 	int depth;
-	int previous_lang_level = -1;
+	int previous_lang_level = INT_MAX;
 	
 	entry = g_new0 (MimeEntry, 1);
 
@@ -361,7 +364,8 @@
 				
 				lang_level = language_level (lang);
 				
-				if (lang_level > previous_lang_level) {
+				if (lang_level != -1 &&
+				    lang_level < previous_lang_level) {
 					char *comment;
 					comment = handle_simple_string (reader);
 					g_free (entry->description);
Comment 4 Allison Karlitskaya (desrt) 2005-03-07 12:51:12 UTC
there's one problem that i forgot to mention.

if you call the old language_level with NULL, then it will return 0.  applying
this patch fragment without also applying the rest of them will cause the NULL
translation (ie: untranslated) to always be counted higher. (since 0 is lower
than anything else).
Comment 5 Allison Karlitskaya (desrt) 2005-04-04 02:49:58 UTC
Just commited this, as per Christian's request.  Closing.