[fpc-pascal] DateToStr locale
Michael Van Canneyt
michael.vancanneyt at wisa.be
Thu Nov 2 14:52:03 CET 2006
On Thu, 2 Nov 2006, Henry Vermaak wrote:
> o.k. i've had a look at the libc source (locale dir). i understand
> the general gist of things, but it'd take ages to implement in pascal
> if i try and transliterate that. it's also not very easy to read (due
> to a generous use of defines). what work has been done on this for
> fpc? is there any (more readable) documentation on the locale binary
> files? posix docs?
>
> to get the time and date format info i'd have to do this:
>
> (1) get the locale that's being used (LANG environment variable).
> mine gives en_GB.utf8
> (2) open the LC_TIME file that can be found under
> /usr/lib/locale/{locale from (1)}/
> (3) extract the date and time format from this file
Yes, this is the idea.
>
> sorry it's not more specific, but that's the main idea. it would
> obviously make sense to implement the whole lot of locale functions.
Indeed. I would expect you to open the correct file, and initialize
all variables from that file.
> i think it's quite fundamental. will fpc choose to mimic what libc
> does?
If you mean read the files and initialize the necessary variables,
the answer is yes.
> it'd quite nice to have a single function that queries certain
> variables from certain categories (e.g. LC_MONETARY, LC_TIME,
> LC_NUMERIC).
That can be done too, but since all constants are in 1 file, it makes
more sense to process the file at once.
Michael.
More information about the fpc-pascal
mailing list