When setting of the xdg-user-dirs-update ($(XDG_CONFIG_HOME)/user-dirs.local) is not same as $LANG (e.g. set the xdg-user-dirs-update to C, $LANG=ja_JP.UTF8), Thunar does not show some strings by $LANG (context menu, contents in side pane, etc... but not all and erratically). I think that it should give priority to $LANG over setting of the xdg-user-dirs. In the case of Japan, to set xdg-user-dirs-update to C is usual because to input Japanese characters is more troublesome than alphabet. Thunar: 0.9.92 (svn-trunk) Distro: Arch Linux
Created attachment 3582 fixes clobbering setlocale() calls I have had a the same problem with the translation falling back to "C" locale or whatever is indicated in ~/.config/user-dirs.locale. The problem seem to be 2 setlocale() calls which do not properly save (i.e. strdup()) the old locale. The solution is derived from the example usage here: http://www.gnu.org/software/libc/manual/html_mono/libc.html#Setting-the-Locale Patch tested with thunar-1.2.1 on Gentoo (x86_64). Should work fine on current git repository. Files are identical. Maybe this should be fixed in plugins/thunar-uca/thunar-uca-model.c as well. But I am not sure. This is my first real patch submit ever. Just let me know if you need anything else.
I don't want to annoy anyone but it seems this bug is still present in latest Thunar.
Two remarks after taking a quick look: 1. we use g_strdup() instead of strdup() 2. if you duplicate a string, you also need to free it (with g_free() in this case)
Created attachment 3814 proposed patch does that patch look reasonable?
Created attachment 3815 test for NULL maybe we need to check for NULL? Why does thunar-shortcuts-model.c use const char * instead of gchar like in thunar-window.c?
(In reply to comment #5) > Created attachment 3815 > test for NULL > > maybe we need to check for NULL? Nope, we don't have to. g_strdup() and g_free() handle NULL just fine. > Why does thunar-shortcuts-model.c use const char * instead of gchar like in > thunar-window.c? "gchar *" is correct if we want to change the content of the pointer once more after the assignment. Also, using "const gchar *" with g_free() shouldn't even compile...
Created attachment 3817 v3 of the patch Ok, reworked the patch once more. Thx
Ok, fixed in master and xfce-4.8 (see the commit message below). I also applied the g_strdup(setlocale(...)) trick to thunar-uca just to be save. commit 594aa7b5be815a84f31a12d8ec49052865734855 Author: Jannis Pohlmann <jannis@xfce.org> Date: Mon Sep 19 15:11:01 2011 +0200 Prevent falling back to an unexpected locale (bug #4746). setlocale() returns a pointer to its internal locale string, so if we want to store the returned string for later use, we need to duplicate it. Patch by Martin Jürgens<martin.accounts@gmx.de> and Mark Trompell<mark@foresightlinux.org>.