Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] localization
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Shawn Wagner <shawnw@s...>
Subject: Re: [Caml-list] localization
On Mon, Apr 29, 2002 at 09:48:18AM +0300, Yurii A.Rashkovskii wrote:
> Guys and gals,
> 

> Is there any standard (or semi-standard) approach for program localization
> in OCaml? (something like gettext, or better) I mean I want to make message
> output in current locale (English, French, Ukranian, Russian and so on :) as
> easy as it is possible.

Here's an idea for an interface to gettext:

Use camlp4 to define a new string literal type (Perhaps using TeX-like
quotes: ``foo''), with one camlp4 module rewriting them into a call to the
translation function for normal compilation, and a second module that is
used to create a .pot file that's used just like one generated from C code
by xgettext. The idea is to make it fairly transparent, and simple to mark
strings that should be translated, without having to clutter up your code
with a lot of things like (Gettext.translate "Something ugly just
happened."). Calling textdomain() or bindtextdomain() would still have to be
done manually (And even that can probably be automated), but otherwise it
should be cleaner than using gettext in C.

-- 
Shawn Wagner
shawnw@speakeasy.org
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners