GNOME Bugzilla – Bug 107468
setlocale( LC_MESSAGES, NULL ) returns "C"
Last modified: 2009-08-15 18:40:50 UTC
I have my I18n set properly: LANG=ru_RU.KOI8-R LC_NUMERIC=POSIX All the applications pick it all correctly. In my applet, I call setlocale(LC_MESSAGES,NULL) and get "C" instead of "ru_RU.KOI8-R" (same code works perfectly in the application). In the environment (analyzed by /proc/{procid}/environ), I see very complex string like "LANG=LC_CTYPE=ru_RU.KOI8-R;LC_MESSAGES=ru_RU.KOI8-R;...". All i18n and l10n are working correctly in the applet (all the gettext stuff). But I need explicit results of setlocale (for non-gnome library to work).
Hi Sergey. What verion of gnome-panel and bonobo-activation is this ?
Hi Mark gnome-panel 2.2.0.1 bonobo-activation 2.2.0 I just wonder - who would need to change the environment for applets...
Since all out-proc applets lost their gettext-based i18n - I set it as high/major. Don't you mind, Mark? Actually, it is quite probably a bonobo bug, not a panel bug...
Same here, see http://bugs.debian.org/214766 It is very easy to reproduce using e.g. the command line applet, the ooqstart applet or the swallow applet. In gnome 2.4, the mail check applet is affected as well, while it wasn't in gnome 2.2. Just start an xterm using any of these applets, and see in the environment: LANG=fr_FR.UTF-8 LC_NUMERIC=C LC_ALL=LC_CTYPE=fr_FR.UTF-8;LC_NUMERIC=C;LC_TIME=fr_FR.UTF-8;LC_COLLATE=fr_FR.UTF-8;LC_MONETARY=fr_FR.UTF-8;LC_MESSAGES=fr_FR.UTF-8;LC_PAPER=fr_FR.UTF-8;LC_NAME=fr_FR.UTF-8;LC_ADDRESS=fr_FR.UTF-8;LC_TELEPHONE=fr_FR.UTF-8;LC_MEASUREMENT=fr_FR.UTF-8;LC_IDENTIFICATION=fr_FR.UTF-8
As Sergey said bonobo set LC_ALL to the current locale in bonobo-activation/bonobo-activation-activate.c near line 722
The applet will inherit it's environment from bonobo-activation-server (somehow) - thus you need to set all the LC_ stuff _before_ the b-a-s is started; do a killall -9 b-a-s logout and login again and it should work as you expect. Otherwise, if you want to debug a wide range of settings, simply running the applet from a console where you've set the env. should work (surely).
Created attachment 21393 [details] [review] Patch from Christian Marillat
*** Bug 126857 has been marked as a duplicate of this bug. ***
Right; so LC_ALL is in the set of variables supported by libbonobo-2.4.2 so I guess this is fixed there. It's also supported by bonobo-activation-2.2.5 so - you just need to upgrade.
Created attachment 21471 [details] [review] Improved patch
Sorry, but Christian's patch was written reversed, so nothing was applied and the bug it still here. His solution consisted in removing LC_ALL support. It doesn't work because, as stated in the glibc documentation¹, the string returned by setlocale for LC_ALL can be anything. I've rewritten the patch to still set the LC_ALL parameters, but to copy it using getenv, not setlocale. ¹ http://www.gnu.org/software/libc/manual/html_node/Setting-the-Locale.html
Switching QA maint to an alias that points at me for easier sorting. Search on 'louie doing alias spam' to find all emails and mark read.
Is this problem still there or has it been fixed in the meantime?
Since libbonobo 2.6 you can export any kind of environment variable from client to the component. In this example, you have to add a string propery of type bononobo:environment with value "LC_ALL" to the applet's .server file. From there on, when any client activates an applet, the exe gets the LC_ALL env. var. matching that of the activating client. I don't think this is documented, my fault :|
IIRC it works OK now. Do not see any troubles any more. Probably if only Gustavo could document the feature of the .server files... Anyway, it is different bug:)