Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Printf and i18n
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-04-18 (08:27)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] Printf and i18n

On Thu, Apr 18, 2002 at 10:02:42AM +0200, Jérôme Marant wrote:

>   By the way, in order to improve the localization process, we would need
>   to add the "argument reordering" feature to printf functions.
>   For instance, with: 
>   printf " %2$d %1$s" "foo" 1

I have something like that, indeed. It is also John Prevost's remark.
For that I use the same system of lexicon, but I don't use printf, but
just print_string for this kind of phrases.

I have specific functions to translate that sort of cases. The string
is scanned by an automat to build the resulting string.

I have as example in my lexicon:

       %1 of %2
   cs: %1 :g:%2
   de: %1 von :d:%2
   en: %2's %1
   fr: %1 d[e']%2
   it: %1 d[i']%2
   pl: %1 :g:%2

There is also some system for elision (before vowels), in French and
in Italian. In French, to translate "Adam's car", you have "la voiture
d'Adam", not "la voiture de Adam".

And there is a system of declination in German and Polish. The :g:
introduces the genitive case for the next phrase. And I have a system
to indicate genitive cases for the other terms.

Another case, the way dates are printed:

   cs: 1. %m %y/%d. %m %y/%m %y/%y
   de: 1. %m %y/%d. %m %y/%m %y/%y
   en: 1 %m %y/%d %m %y/%m %y/%y
   fr: 1er %m %y/%d %m %y/%m %y/%y
   it: 1o %m %y/%d %m %y/%m %y/%y
   pl: 1 %m %y/%d %m %y/%m %y/%y

%m = month, %y = year %d = day

The slash separate the cases:
   first in the month
   other in the month
   date when there is only month and year
   date when there is only year

Of course, in all these examples, printf does not work: you have to
apply print_string, or printf "%s"

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: