LC_TIME for Buddhist Era in Thailand

NUMATA Toshinori numata at jp.fujitsu.com
Fri May 13 03:35:42 PDT 2005


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