[Rd] Internationalizing the Rcmdr package?

Uwe Ligges ligges at statistik.uni-dortmund.de
Sun May 22 13:10:40 CEST 2005


For sure you have already read the write ups at 
http://developer.r-project.org/Translations.html as well as the 
corresponding sections in "Writing R Extesnsions"? There is also an 
article in the recent R News.

I have tried out a toy example some time before the docs were that 
complete (February-March?), and it already worked very well. Rcmdr is a 
much bigger task, of course!

Peters point ("Accept/Break/Cancel" translates to 
"Accepter/Afbryd/Annuller") is a very important one. A similar problem 
with translations of RGui broke my workarounds for RWinEdt....

Uwe



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