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 760436 - [PATCH] vapigen --help shows translated characters as question marks on some locales
[PATCH] vapigen --help shows translated characters as question marks on some ...
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: general
unspecified
Other FreeBSD
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2016-01-11 06:47 UTC by Ting-Wei Lan
Modified: 2016-06-18 11:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
vapigen: Call setlocale in main function (818 bytes, patch)
2016-01-11 06:48 UTC, Ting-Wei Lan
committed Details | Review

Description Ting-Wei Lan 2016-01-11 06:47:57 UTC
Please see the attached patch. vapigen should call setlocale in main function in order to correctly show translated messages.

Running 'vapigen --help' with zh_TW.UTF-8 locale shows:
???
  vapigen [???] FILE... - Vala API Generator

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

???????
  --vapidir=DIRECTORY...         Look for package bindings in DIRECTORY
  --girdir=DIRECTORY...          Look for GIR bindings in DIRECTORY
  --metadatadir=DIRECTORY...     Look for GIR .metadata files in DIRECTORY
Comment 1 Ting-Wei Lan 2016-01-11 06:48:59 UTC
Created attachment 318704 [details] [review]
vapigen: Call setlocale in main function

It is required to correctly show translated messages on some locales.
Comment 2 Ting-Wei Lan 2016-06-18 10:31:14 UTC
I know this is a trivial patch, but it is really required. An output with characters replaced by question marks is not readable. Does someone have time to review the patch?
Comment 3 Al Thomas 2016-06-18 10:53:17 UTC
Review of attachment 318704 [details] [review]:

The patch looks good to me and follows the main function in valac - see https://git.gnome.org/browse/vala/tree/compiler/valacompiler.vala
Valac has had no problems changing the locale from the default C locale to LC_ALL.
So I see no problem with both the main functions in valac and vapigen calling Intl.setlocale ();
I assume you have been using the patch for some time now with vapigen and had no problems?

Since https://git.gnome.org/browse/vala/commit/?id=31e8f35c0057927156287755837ff68308477a8f LC_ALL has been set as the default locale when using setlocale().
So Intl.setlocale (); is all that is needed. I'm wondering if both valac and vapigen should use this to show best practise in the code base?
Comment 4 Al Thomas 2016-06-18 11:01:08 UTC
Review of attachment 318704 [details] [review]:

Thinking about it a bit more, changing it to Intl.setlocale (); would prevent Vala being compiled with Vala earlier than versions 0.26.2
It is fine as it is.
Comment 5 Ting-Wei Lan 2016-06-18 11:35:51 UTC
(In reply to Al Thomas from comment #3)
> Review of attachment 318704 [details] [review] [review]:
> 
> The patch looks good to me and follows the main function in valac - see
> https://git.gnome.org/browse/vala/tree/compiler/valacompiler.vala
> Valac has had no problems changing the locale from the default C locale to
> LC_ALL.
> So I see no problem with both the main functions in valac and vapigen
> calling Intl.setlocale ();
> I assume you have been using the patch for some time now with vapigen and
> had no problems?

Yes, I have used the patch in my jhbuild prefix since the patch was posted. I see no problem that is related to locale.
Comment 6 Ting-Wei Lan 2016-06-18 11:37:21 UTC
Attachment 318704 [details] pushed as d07e8e8 - vapigen: Call setlocale in main function