Control: retitle -1 paps does not honor locales
Control: tags -1 patch

On 2014-08-26 13:04:36 +0200, Vincent Lefevre wrote:
> The paps --header option outputs the date in the header, but the
> format is the same as "LC_TIME=C date +%c", i.e. in the C locale.
> 
> Correct software honors locales. This is a must.

Actually, the messages are also affected, not just the date.

I've attached a patch to make paps honor all locales. It just does

  setlocale (LC_ALL, "");

early in main(). This fixes the date format, but also messages.
For instance, without the patch:

$ LC_ALL=fr_FR paps -foo
Command line error: Unknown option -foo

and with the patch:

$ LC_ALL=fr_FR paps -foo
Command line error: Option inconnue -foo

Not everything is translated, but that's another problem.

Note: the only setlocale occurrence in paps.c was:

[...]
static PangoLanguage *
get_language(void)
{
  PangoLanguage *retval;
  gchar *lang = g_strdup (setlocale (LC_CTYPE, NULL));
  gchar *p;
[...]

This just reads the LC_CTYPE locale, but without honoring the
locales as my patch does, this is rather useless, as one always
gets the C locale! So, my patch may change something here too,
probably fixing something.

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Description: honor locales
Bug-Debian: http://bugs.debian.org/759331
Author: Vincent Lefevre <vinc...@vinc17.net>

--- a/src/paps.c
+++ b/src/paps.c
@@ -332,6 +332,8 @@
   GIConv cvh = NULL;
   GOptionGroup *options;
 
+  setlocale (LC_ALL, "");
+
   /* Prerequisite when using glib. */
   g_type_init();
 

Reply via email to