Re: [hypermail] French translation (cont'd)

---------

New Message Reply About this list Date view Thread view Subject view Author view

From: Emmanuel Blot (emmanuel.blot@sun.com)
Date: Fri Nov 23 2001 - 08:47:11 CST


>
>
>
>>+#ifdef HAVE_LOCALE_H
>>+ if ( ! setlocale(LC_ALL, set_language) ) {
>>+ sprintf(errmsg, "WARNING: setlocale: \"%s\" %s.", set_language,
>>+ lang[MSG_LANGUAGE_NOT_SUPPORTED]);
>>+ fprintf(stderr, errmsg);
>>+ }
>>+#endif
>>
>
> I get this warning when I run it:
>WARNING: setlocale: "en" Language not supported.
>

Ok, I found the problem:
Several system are relying on a more complex locale definition, that is,
locale needs two parameters:
  * language
  * country

that is, locale parameter is ll_cc[opt]

where:
  ll is the language in ISO language format, lowercase
  cc is the country in ISO country format, uppercase
  opt (optional parameters) may vary, for example it can be "@euro"

for example, english language can be set as:

  en_GB
  en_IE
  en_US

etc. You can find the complete list available on your system in
/usr/share/i18n/locales

How to deal with such a parameter in hypermail ?

  1/ use two parameters: one for the message language, one for the
LC_TIME localization
      I don't really like this idea. It's not straightforward for the
end user
  2/ use one parameters, in ISO format:
        en_GB or fr_FR for example
      It could be easily achieve this way:

#ifdef HAVE_LOCALE_H
    #use the full ISO locale for system
    if ( ! setlocale(LC_TIME /*or LC_ALL */, set_language) ) {
        sprintf(errmsg, "WARNING: setlocale: \"%s\" %s.", set_language,
                lang[MSG_LANGUAGE_NOT_SUPPORTED]);
        fprintf(stderr, errmsg);
    }
#endif

    # restrict locale to the language parameter, remove country and
extra paramters if any
    if ( strlen(set_language) > 2 && set_language[2] == '_' ) {
      set_language[2] = '\0';
    }

    # the old code is not changed
    if ((tlang = valid_language(set_language)) == NULL) {
        sprintf(errmsg, "\"%s\" %s.", set_language,
                lang[MSG_LANGUAGE_NOT_SUPPORTED]);
        cmderr(errmsg);
    }

It also requires a smal effort on the help message, and an updated
FAQ/documentation, in order to produce something like this:

> -L lang : Specify language to use (de_* en_* es_* fi_* fr_*
is_* se_* )

(note that the se_ parameter has still to be changed to match the ISO
format: sv_*)

I think this new implementation will fix up the problem AND provide
'standard' localization.

Regards,
Emmanuel.


New Message Reply About this list Date view Thread view Subject view Author view

---------

This archive was generated by hypermail 2b29.