LC_TIME for Buddhist Era in Thailand

Thawatchai Piyawat t.piyawat at gmail.com
Fri May 13 13:44:31 PDT 2005


Hello Toshinori,

Thanks a lot for the information. I read the files you've pointed out
and also found that src/lib/libc/locale/nl_langinfo.c has ERA cases
that are marked /* XXX: need to be implemented */ So, it's quite sure
that ERA hasn't yet been supported in FreeBSD.

BTW, glibc supports ERA. A Linux guy in Thailand defined ERA with this
statement:

%era     "+:1:-542/01/01:+*:<th190><period><th200><period>:%N<SP>%o"

It seems to be the same syntax as in the standard document.

Thawatchai


On 5/13/05, NUMATA Toshinori <numata at jp.fujitsu.com> wrote:
> Hi,
> 
> Thawatchai Piyawat wrote:
> 
> > I've created a locale th_TH (Thai in Thailand). It can be found in
> > ports/misc/thailocale. Everything seems to work fine so far except a
> > problem in LC_TIME.
> >
> > To solve the problem, I would like to ask everyone the following questions:
> >
> > 1) In Thailand, we use the Buddhist Era that starts 543BC. This year
> > (2005) is the year 2548 in Thailand. The problem is that I can't
> > figure out how to put "plus 543" in the LC_TIME file.
> 
> I've read the source code of libc's time- and locale-related
> functions.  It seems to me that the current LC_TIME support
> does not have "era" support.
> 
> I've read the following files:
> 
>   src/lib/libc/locale/setlocale.c
>   src/lib/libc/stdtime/timelocal.h
>   src/lib/libc/stdtime/timelocal.c
> 
> and found that the lc_time_T structure defined in timelocal.h
> (which is used to contain locale-dependent strings for month
> names, date format, etc.) does not have any era-related members.
> 
> The Single UNIX Specification, the standard for UNIX systems,
> defines how to describe era in LC_TIME definition.  Currently
> only commercial UNIX systems such as Solaris and HP-UX have
> suport of era.  The following is the manual for HP-UX:
> 
> http://docs.hp.com/en/B9106-90011/localedef.4.html
> 
> Search for "LC_TIME" and see how era definitions are described.
> 
> 
> > 2) I can't find a syntax reference for FreeBSD locale definitions.
> > I've created th_TH by looking at the source of other locales. This
> > method works, but it doesn't give me certainty that what I've done is
> > correct. If such references exist, it would really help me.
> 
> I couldn't find such document neither.  The format of LC_TIME
> seems that the file contains lines of text string, each line
> corresponds to one string entry of lc_time_T structure.  For
> example, the first line corresponds to mon[0] string, the
> second line to mon[1] string, and so on.
> 
> The lines that begin with "#" character are comments and will
> be deleted before installation, so only data lines are included
> in the installed locale files.
> 
> 
> Toshinori NUMATA
>


More information about the freebsd-i18n mailing list