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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: STARYNKEVITCH Basile <Basile.Starynkevitch@c...>
Subject: localization, internationalization and Caml

Hello All,

Just a small remark about localization and internationalization (see
your setlocale printf strtod man pages), which means adapting a
software to culturally different users. Problems include date
representation, number representation, error messages, and even
character sets and left-right or right-left human reading. For example
some french people want "Taux d'inflation = 3,14% - TROP" instead of
"TOO MUCH inflation 3.14%" (message in english/french, numbers with
decimal point/comma, argument 3.14 and string "TOO MUCH" or "TROP"
(locale dependent) in different order.

I am not at all a fan of localization. But I do have a wish if it ever
occur in Ocaml:

* do not depend on C localization (This means Printf.printf should not
  depend on LC_NUMERIC environment variable. Is this true now?)

* make the locale an explicit argument, or at least a property bound
  to a channel. Several channels may need different locales (for
  instance an HTTP socket needs a C locale, while the user stderr
  could be in French locale)

  so 

    lprintf Locale.French "%d %g" 2 3.14

  is much better than

    set_locale LC_ALL "FR"
    printf "%d %g" 2 3.14



By the way, I more and more believe that the printf interface is (in C
as in Ocaml) a big mistake (which could easily be avoided in Ocaml,
thanks to it typing)

We should code

  print [Int 2; String " < "; Float 3.14]

instead of 

  printf "%d < %g" 2 3.14


Again, I am *not* asking for localization in Ocaml, but if somebody
needs it (I don't) I still hope it would be implemented better than in
C. And I think that Unicode would be more useful than localization.


I'm saying all this because I have now a headache regarding C
localization, so hope that Ocaml will avoid that mistake.

################

Court Resumé: je pense que la localisation en Ocaml -dont je ne ressens pas
le besoin- ne devrait pas être faite comme en C.

N.B. Any opinions expressed here are only mine, and not of my organization.
N.B. Les opinions exprimees ici me sont personnelles et n engagent pas le CEA.

---------------------------------------------------------------------
Basile STARYNKEVITCH   ----  Commissariat à l Energie Atomique 
DTA/LETI/DEIN/SLA * CEA/Saclay b.528 (p111f) * 91191 GIF/YVETTE CEDEX * France
phone: 1,69.08.60.55; fax: 1.69.08.83.95 home: 1,46.65.45.53
email: Basile point Starynkevitch at cea point fr