[fpc-pascal] locale solution for unix systems

Graeme Geldenhuys graemeg.lists at gmail.com
Thu Mar 19 10:32:03 CET 2009


On Thu, Mar 19, 2009 at 10:55 AM, ik <idokan at gmail.com> wrote:
> The locale itself is not just ascii based files, there are compiled
> files, so you will require to re-implement the way of reading the data
> inside the compiled files.

I'm not talking about the "compiled binary files", I am talking about
the text based locale files. On my Linux Ubuntu 7.10 system they are
include in the 'locales' package and are install in the following
directory location:
  /usr/share/i18n/locales/*

eg:
usr/share/i18n/locales/wo_SN
/usr/share/i18n/locales/xh_ZA
/usr/share/i18n/locales/yi_US
/usr/share/i18n/locales/zh_CN
/usr/share/i18n/locales/zh_HK
/usr/share/i18n/locales/zh_SG
/usr/share/i18n/locales/zh_TW
/usr/share/i18n/locales/zu_ZA

> For example here in Israel our first work day in the week is Sunday
> and not Monday, so you will need to work with it. Also our date format
> is dd/mm/yyyy and not mm/dd/yyyy or yyyy/mm/dd
> etc.. Currency separator is comma, the actual names of things are in

Here is the details of the /usr/share/i18n/locales/he_IL file:

----------------[ he_IL ]-----------------------
<.....snip......>
LC_MONETARY
int_curr_symbol   "<U0049><U004C><U0053><U0020>"
currency_symbol   "<U05E9><U05D7>"
mon_decimal_point "<U002E>"
mon_thousands_sep "<U002C>"
mon_grouping      3;3
positive_sign     ""
negative_sign     "<U002D>"
int_frac_digits   2
frac_digits       2
p_cs_precedes     1
p_sep_by_space    1
n_cs_precedes     1
n_sep_by_space    1
p_sign_posn       2
n_sign_posn       2
END LC_MONETARY

<.....snip....>

LC_TIME
<...snip....>
d_fmt   "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0079>"
t_fmt   "<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>"
first_weekday 1
END LC_TIME

<....snip....>
----------------------[  end  ]---------------


For example: South Africa's date format is also dd/mm/yyyy and is
defined as follows:

% Date representation to be referenced by the "%x" field descriptor -
% "%d/%m/%Y", day/month/year as decimal numbers (01/01/2000).
d_fmt       "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0059>"

> Hebrew, so for each locale you will require to re-implement all of
> this rules. That's why using the libc functions is better.

All the locale information seems to be in those text files (date,
time, paper size, day;week;month names, measurements, names, addresses
 etc.). It's just a matter of parsing them and populating the locale
variables in FPC. No external programs or libraries are required.

As per fpGUI Toolkit's design rules: I hate 3rd party requirements!  :-)

BTW: Does FPC's locale variables cover all the locale categories? For example:

category  "en_ZA:2003";LC_IDENTIFICATION
category  "en_ZA:2000";LC_CTYPE
category  "en_ZA:2000";LC_COLLATE
category  "en_ZA:2003";LC_TIME
category  "en_ZA:2000";LC_NUMERIC
category  "en_ZA:2000";LC_MONETARY
category  "en_ZA:2003";LC_MESSAGES
category  "en_ZA:2000";LC_PAPER
category  "en_ZA:2000";LC_MEASUREMENT
category  "en_ZA:2003";LC_NAME
category  "en_ZA:2003";LC_ADDRESS
category  "en_ZA:2003";LC_TELEPHONE

If not, can we extend the FPC locale variable to include salutation
(names), telephone, measurement, paper sizes etc..

Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-pascal mailing list