[Ocaml-i18n] proposal: message catalogue system

Benjamin Geer ben at socialtools.net
Tue Dec 2 15:29:43 PST 2003


Sylvain LE GALL wrote:
> Well, i won't quote your whole message. So i just give some idea : 
> - using a text key which is the original sentence which need to be
>   translated is GOOD. Because most of the time translation is a feature
>   not the key of the program. So it should not be blocking for the rest
>   of the APP ( ie if a single translation doesn't not exist, it must not
>   issue an arbitrary key, nor raise an exception.

The program can always have a default language, so if a translation for 
a key doesn't exist, it can use the equivalent text in the default 
language.  This has worked fine on projects I've worked on.  It's also 
what gettext does, isn't it?  If you use symbolic keys, the only 
difference is that the text for the default language isn't in the source 
code; it's in a separate file.

Program text is often written by usability specialists or marketing 
people, not by programmers.  Having text in files that those people can 
edit is an advantage, isn't it?

Still, there's nothing in my proposal to stop you from using the 
original sentence as a key; as far as the message catalogue facility is 
concerned, keys are just strings.

> - if you really want to use anything else as a key, why don't you use
>   "KEY_1" as a key ( ie string as key ). I think it is not good but...

Using strings as keys is exactly what I proposed, but why not use 
meaningful keys ("files_in_directories") instead of arbitrary ones 
("KEY_1")?

> - using more than one function ( or brackets or anything else ) is
>   getting inefficient when you have already complex function ( ie i
>   don't think anyone want to have a big source code just because of
>   translation ).

I think it's unwise to say that something is inefficient before you've 
tested it.  It only needs to be efficient *enough*.  And have you looked 
at the code that a translator has to write in order to handle complex 
plurals in gettext?  Here's an example for Slavic languages, taken from 
the gettext manual:

Plural-Forms: nplurals=3; \
   plural=n%10==1 && n%100!=11 ? 0 : \
     n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;

Complexity is inherent in the problem, because languages are complex. 
However, I think the syntax above is horrible, and I think the syntax I 
proposed would be much easier for a translator to handle.

> I recommend to use gettext. I think it is the most powerful tool for
> translation. You can extract text...

Did you read the article I was discussing?  I think it makes a pretty 
strong case that gettext is inadequate.  Here's the link again:

http://www.icewalkers.com/Perl/5.8.0/lib/Locale/Maketext/TPJ13.html

Ben




More information about the Ocaml-i18n mailing list