[R] gettext weirdness
Florent Angly
florent.angly at gmail.com
Mon Feb 4 08:15:42 CET 2013
Hi,
I am trying to use the gettext() function to translate some text. I have
never used this function before, so, it's entirely possible that I am
doing something wrong. The issue that I am encountering is that
gettext() properly translates some text, but not some other.
Natural language was compiled in my R (installed from the Debian
repositories):
$ R
R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
[...]
Natural language support but running in an English locale
[...]
> q()
Here is some text that has some translation in the file ./po/fr.po:
#: src/main/errors.c:290
msgid "invalid option \"warning.expression\""
msgstr "option incorrecte \"warning.expression\""
[...]
#: src/main/errors.c:582
msgid "Error in "
msgstr "Erreur dans "
Start R in French and see if I can get something translated to French:
$ LANG=fr_FR.UTF8 R
> stop('This is an error')
Erreur : This is an error
> bindtextdomain("R") # does not seem necessary, but just to be safe...
[1] "/usr/share/R/share/locale"
> gettext("Error in ", domain="R")
[1] "Error in "
> "invalid option \"warning.expression\"" -> msg; gettext(msg, domain="R")
[1] "option incorrecte \"warning.expression\""
So, the stop() function successfully translates. I can also manually
translate some entries, but why can does it not work for gettext("Error
in ", domain="R")?
Any idea?
Thanks
Florent
More information about the R-help
mailing list