[Harbour] SF.net SVN: harbour-project:[11052] trunk/harbour

Szakáts Viktor harbour.01 at syenar.hu
Mon May 18 05:01:52 EDT 2009


Hi Przemek,

>> 2009-05-15 09:21 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
>>  * include/hbextern.ch
>>  * source/rtl/Makefile
>>  + source/rtl/lang.c
>>    + Added HB_USERLANG() function to retrieve ietf code of
>>      language set by user. Works also on Windows.
>
> In this code and also in other places you are using lang IDs in
> the form <LL>-<CC>. Nearly all tools I'm using use a little bit
> different convention and store LANG id in the form <LL>_<CC>
> where <LL> is an ISO 639 two-lower-letter language code and <CC>
> is an ISO 3166 two-upper-letter country code.
> It's also the convention used for LNAG envvar which has form:
>   <LL>_<CC>[.<enconding>]

AFAICS the standard says that the delimiter is '-', that's
why I choose it. Many tools use '_', that's true (not all though).
Sometimes (like in filenames) '_' is more convenient than '-'.

F.e. in hbmk2 code I'm doing the conversion locally from '-'
to '_', but internally I'm dealing with '-' flavor. F.e IMO
it's best to store standard lang code in databases, where you
don't know where will you use them in the future.

If we decide it's better to use '_' we can do it though.

Anyhow if LANG returns '_' (also on OSX), we should fix
HB_USERLANG() to convert it to '-' to stay consistent.

> f.e. in my current computer `echo $LANG` returns:
>   pl_PL.UTF-8
> Can we use the same convention instead of our own?

This function does strip lang from the encoding, so it should
in this case return pl_PL. Anyhow please feel free to modify
it as you feel it best. We should in the future also deal
with the encoding part, when we have the infrastructure
inside Harbour.

> As I can see HB_USERLANG() also looks for LC_ALL and LC_MESSAGES  
> envvars.
> I think you should check for "C" and "POSIX" values which are often
> used to disable some type of national settings and do not return then
> as language ID.

You must be right, but I'm lost here, again please do
any modification you think is good.

Brgds,
Viktor



More information about the Harbour mailing list