[Rd] Internationalizing the Rcmdr package?

Philippe Grosjean phgrosjean at sciviews.org
Sun May 22 06:52:52 CEST 2005

Hello John and Peter (and all),

Yes, it is probably better to use the same method as R uses, with po 
files and gettext(). We are currently translating R in French and it 
takes one hour or two to figure out how to do these translations with, 
let's say, poedit. We would not like to deal with different exotic 
translation files for different additonal packages.

I volunteer to translate RCmdr in French. You know it will be very 
useful for my students.

You are certainly better to ask Brian Ripley directly for details on how 
to implement this. However, may I suggest you first look at the code and 
the ./po subdirectory of base and recommended packages of the R 2.1.x 
version (for instance, source of base, graphics, or packages in the VR 
bundle -class, MASS, nnet & spatial-) to get an idea of changes 
introduced for internationalization.


  ) ) ) ) )
( ( ( ( (    Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (    Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Pentagone (3D08)
( ( ( ( (    Academie Universitaire Wallonie-Bruxelles
  ) ) ) ) )   8, av du Champ de Mars, 7000 Mons, Belgium
( ( ( ( (
  ) ) ) ) )   phone: +, fax: +
( ( ( ( (    email: Philippe.Grosjean at umh.ac.be
  ) ) ) ) )
( ( ( ( (    web:   http://www.umh.ac.be/~econum
  ) ) ) ) )          http://www.sciviews.org
( ( ( ( (

Peter Dalgaard wrote:
> "John Fox" <jfox at mcmaster.ca> writes:
>>Dear R-devel list members,
>>I'm considering adding support for other languages than English to the Rcmdr
>>package. I understand that the use of Tcl/Tk by the Rcmdr package means I
>>won't be able to make full use of the internationalization facilities in R
>>2.1.0. I'm interested, therefore, in whether the following, more limited,
>>strategy (which bears some similarity to the internationalization facilities
>>in R) seems reasonable or whether there's a better approach. As well, I'm
>>interested in whether the proposed approach is sufficiently flexible to be
>>worthwhile -- does it cover enough languages?
>>It would be simple for me to provide a file of messages, labels, and other
>>text used by the Rcmdr, organizing this file with one message per line. A
>>copy of the file, named, e.g., messages.francais, could contain translations
>>into another language (e.g, French). Setting
>>options(Rcmdr=list(language=francais)) would then activate translation when
>>the Rcmdr starts up, reading the messages file into a data frame, treating
>>the English text as row names. The messages could be handled by a function,
>>say Text(), which would return English or translated text, as appropriate.
>>Some experimentation shows that message retrieval by this scheme is
>>essentially instantaneous even when there are several thousand relatively
>>long messages in the data frame. 
> Offhand, I think you're better off latching on to an existing
> mechanism. Tcl has something known as "msgcat", which appears to be
> similar to GNU gettext (and there are conversion tools), or perhaps
> you could interface to gettext itself (we do have the gettext()
> function at the R level).
> Two tricky bits: 
> (A) shortcut keys, which need to be coordinated to menu items
>     ("Accept/Break/Cancel" translates to "Accepter/Afbryd/Annuller" in
>     Danish - if you're a little malicious, anyway)
> (B) What is the general mechanism for extending message catalogs by an
>     R package?
> Brian may well have thought of this stuff already.

More information about the R-devel mailing list