std.locale
Michel Fortin
michel.fortin at michelf.com
Mon Mar 2 05:49:09 PST 2009
On 2009-03-02 08:32:40 -0500, Leandro Lucarella <llucax at gmail.com> said:
> I'm not following this thread carefully and I don't know if this is what
> you are implying, but: Please don't you even think in duplicating the
> locale stuff, at least on unix there is a very nice database that needs to
> be updated sometimes very often (due to stupid presidents like the one
> I have now that changes the summer saving time all the time).
>
> PHP for example maintains a copy of this locale data and is a real PITA.
I do agree.
In another post I proposed we create formatter classes for numbers and
dates. This way, you can use a formatter binding to the UNIX database
and APIs, or the Windows APIs, or Cocoa, etc., or you can build your
own. All you need is a generic front end formatter interface you can
bind to anything (and a common internal representation for dates)
something like:
interface DateFormatter
{
string timestampToString(int timestamp);
int stringToTimestamp(string date);
}
DateFormatter defaultDateFormatter();
DateFormatter dateFormatterForLocale(string localeName);
interface NumberFormatter
{
string intToString(int number);
int stringToInt(string number);
}
NumberFormatter defaultNumberFormatter();
NumberFormatter numberFormatterForLocale(string localeName);
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list