[Rd] gettext() and messages in 'pkg' domain

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Dec 30 11:39:27 CET 2007


On Sun, 30 Dec 2007, Philippe Grosjean wrote:

> Hello,
>
> As I understand it, gettext() is designed to retrieve messages from
> 'R-pkg' domains. As such, it cannot retrieve some of the messages in the
> 'pkg' domains (those supposed to be accessed by C code only, I know),
> namely, all messages ending with space(s) or \n. This is clearly
> indicated in ?gettext (at least for trailing spaces):
>
> "For 'gettext', leading and trailing whitespace is ignored when looking
> for the translation."

(\n _is_ whitespace).

> So, my questions:
> 1) Do I really need to write C code to retrieve all messages from 'pkg'
> domain?

Yes.

> 2) Wouldn't it be useful to add an argument to gettext() (like trim =
> TRUE), or alternatively, to propose a Gettext() function in utils
> packages that allows retrieving those messages with trailing space(s) or
> \n in 'pkg' domain from R code?

Apparently only useful to you: it's certainly not useful for the 
internationalization of R itself, and I don't see why you can't organize 
the package so that the C-level messages don't have leading/trailing 
whitespace *if* you want to mix up domains.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list