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

From: Emmanuel Blot <emmanuel.blot_at_sun.com_at_hypermail-project.org>
Date: Fri, 23 Nov 2001 14:47:11 +0000
Message-ID: <3BFE616F.7020108_at_sun.com>


>
>
>
>>+#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:

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 "_at_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. Received on Fri 23 Nov 2001 08:13:41 PM GMT

This archive was generated by hypermail 2.2.0 : Thu 22 Feb 2007 07:33:53 PM GMT GMT