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 760425 - [PATCH] gnome-session --help and gnome-session-quit --help shows translated characters as question marks on some locales
[PATCH] gnome-session --help and gnome-session-quit --help shows translated c...
Status: RESOLVED FIXED
Product: gnome-session
Classification: Core
Component: general
git master
Other FreeBSD
: Normal normal
: ---
Assigned To: Session Maintainers
Session Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-01-11 06:04 UTC by Ting-Wei Lan
Modified: 2016-01-24 14:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Call setlocale in main function of gnome-session-binary and gnome-session-quit (1.42 KB, patch)
2016-01-11 06:05 UTC, Ting-Wei Lan
committed Details | Review

Description Ting-Wei Lan 2016-01-11 06:04:13 UTC
Please see the attached patch. gnome-session-binary and gnome-session-quit should call setlocale in main function in order to correctly show translated messages.

Running 'gnome-session --help' with zh_TW.UTF-8 locale shows:
???
  gnome-session-binary [???]  - GNOME ???????

?????
  -h, --help                        ???????

???????
  -a, --autostart=AUTOSTART_DIR     ???????????
  --session=SESSION_NAME            ????????
  --debug                           ?????
  -f, --failsafe                    ??????????????
  --version                         ???????
  --whale                           ?????????????
  --disable-acceleration-check      ????????

Running 'gnome-session-quit --help' with zh_TW.UTF-8 locale shows:
???
  gnome-session-quit [???] 

?????
  -h, --help       ???????

???????
  --logout         ??
  --power-off      ????
  --reboot         ????
  --force          ???????????
  --no-prompt      ???????
Comment 1 Ting-Wei Lan 2016-01-11 06:05:38 UTC
Created attachment 318693 [details] [review]
Call setlocale in main function of gnome-session-binary and gnome-session-quit

It is required to correctly show translated messages on some locales.
Comment 2 Matthias Clasen 2016-01-11 12:42:02 UTC
Looks right to me
Comment 3 Ray Strode [halfline] 2016-01-21 15:03:29 UTC
Attachment 318693 [details] pushed as 788b64a - Call setlocale in main function of gnome-session-binary and gnome-session-quit
Comment 4 Michael Catanzaro 2016-01-23 00:23:32 UTC
Note that for Linux you need to #include <locale.h> when you do this; we have fixup commits to do this for both GDM and Epiphany.
Comment 5 Michael Catanzaro 2016-01-23 00:23:49 UTC
(I mean gnome-session, not GDM.)
Comment 6 Ting-Wei Lan 2016-01-24 14:47:23 UTC
Yes, I failed to notice the difference in between libintl.h provided by gettext-runtime and glibc when submitting patches. The version provided by glibc only includes locale.h when optimization is enabled, while the version provided by gettext-runtime always includes locale.h.

I checked remaining 13 bug reports and patches. Only 1 of them needs updating, and I updated it to include locale.h just now.