[Ocaml-i18n] Re: [Caml-list] Camomile-0.5.0
Benjamin Geer
ben at socialtools.net
Sat Jun 12 02:29:55 PDT 2004
Yamagata Yoriyuki wrote:
> There is a tension between purely functional style and the style using
> implicit states. I am not sure about which style is better.
I think having a default locale based on the environment isn't bad. It
keeps things simple for beginners who aren't ready to think about
locales yet. Being able to change the default at run time wouldn't be
bad either, and might handle Richard's wish not to have to specify
locales lots of times in his program. However, I think it's important
to be able to use several different locales simultaneously. Sometimes
the right locale depends not on who the user is, but on what they're
doing. I often have to work with multilingual data. At the moment I'm
working on a financial application (not in Caml) in which we're supposed
to allow users to specify that they want dates displayed in a certain
locale, and currencies displayed in a different locale. A
multi-threaded web application would also need to handle different
locales at the same time.
An approach that would seem appealing to me would be if you could create
a locale object for any locale you want, and from that object, get other
reusable objects that do the real work (formatting dates, translating
strings, etc.). That might also be OK for Richard: when the process
starts to handle an HTTP request, it could get the appropriate locale
object, then from that get date formatters and so on, and use those over
and over without ever having to specify the locale again. If it's not
multi-threaded, it could even keep them in global variables (although I
know John Skaller wouldn't approve :) .
Ben
More information about the Ocaml-i18n
mailing list