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 107468 - setlocale( LC_MESSAGES, NULL ) returns "C"
setlocale( LC_MESSAGES, NULL ) returns "C"
Status: VERIFIED INCOMPLETE
Product: bonobo
Classification: Deprecated
Component: general
2.2.x
Other Windows
: High major
: ---
Assigned To: Michael Meeks
bonobo qa
: 126857 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2003-03-03 14:52 UTC by Sergey V. Udaltsov
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
Patch from Christian Marillat (623 bytes, patch)
2003-11-12 19:06 UTC, Josselin Mouette
none Details | Review
Improved patch (1.04 KB, patch)
2003-11-15 00:40 UTC, Josselin Mouette
none Details | Review

Description Sergey V. Udaltsov 2003-03-03 14:52:33 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).
Comment 1 Mark McLoughlin 2003-03-03 20:11:19 UTC
Hi Sergey. What verion of gnome-panel and bonobo-activation is this ?
Comment 2 Sergey V. Udaltsov 2003-03-04 10:47:04 UTC
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...
Comment 3 Sergey V. Udaltsov 2003-05-01 22:12:55 UTC
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...
Comment 4 Josselin Mouette 2003-10-23 18:51:53 UTC
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
Comment 5 Christian Marillat 2003-10-26 10:41:09 UTC
As Sergey said bonobo set LC_ALL to the current locale in
bonobo-activation/bonobo-activation-activate.c near line 722
Comment 6 Michael Meeks 2003-10-27 09:33:39 UTC
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).
Comment 7 Josselin Mouette 2003-11-12 19:06:30 UTC
Created attachment 21393 [details] [review]
Patch from Christian Marillat
Comment 8 Vincent Untz 2003-11-13 09:00:34 UTC
*** Bug 126857 has been marked as a duplicate of this bug. ***
Comment 9 Michael Meeks 2003-11-14 14:46:27 UTC
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.
Comment 10 Josselin Mouette 2003-11-15 00:40:22 UTC
Created attachment 21471 [details] [review]
Improved patch
Comment 11 Josselin Mouette 2003-11-15 00:45:27 UTC
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
Comment 12 Luis Villa 2004-02-21 18:34:28 UTC
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.
Comment 13 Kjartan Maraas 2005-01-06 14:48:12 UTC
Is this problem still there or has it been fixed in the meantime?
Comment 14 Gustavo Carneiro 2005-01-06 14:57:52 UTC
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 :|
Comment 15 Sergey V. Udaltsov 2005-01-06 20:20:42 UTC
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:)