GNOME Bugzilla – Bug 760436
[PATCH] vapigen --help shows translated characters as question marks on some locales
Last modified: 2016-06-18 11:37:24 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
Created attachment 318704 [details] [review] vapigen: Call setlocale in main function It is required to correctly show translated messages on some locales.
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?
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?
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.
(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.
Attachment 318704 [details] pushed as d07e8e8 - vapigen: Call setlocale in main function