[Ocaml-i18n] locales in Camomile and OCamlI18n

Yamagata Yoriyuki yoriyuki at mbg.ocn.ne.jp
Mon May 24 08:03:18 PDT 2004


From: skaller <skaller at users.sourceforge.net>
Subject: Re: [Ocaml-i18n] locales in Camomile and OCamlI18n
Date: 24 May 2004 14:16:42 +1000

> This is easy to fix. Use PXP to parse the data
> and convert to a specified internal Ocaml data
> structure and simply Marshal it out.

Loding marshaled data is still expensive, so we would want to load only
one time in the process's lifetime.  There would be two method to
achieve this.  The one way is explicitly loading a locale data as,

let locale = load_locale "ja_JP" in 

...

let s = string_of_int ~locale 1234567 in

...


But the syntax is a bit heavy.

Another way is cashing them in (Weak)Hashtbl.  (Camomile does this
currently)

> Felix does this to lex/parse files, with a version
> and time stamp check to ensure the internal format
> is coherent and up to date. (Make sure to put the
> Ocaml compiler version in so the data is reparsed
> when you upgrade Ocaml too).

If we have a support for persitent data across different instances of
the locale library with different uid and permissions, then it would
be a way to go.  Unfortunately, we do not have such a one, unless we
throw away portability.

--
Yamagata Yoriyuki




More information about the Ocaml-i18n mailing list