[R] gettext weirdness
florent.angly at gmail.com
Mon Feb 4 08:15:42 CET 2013
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
R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
Natural language support but running in an English locale
Here is some text that has some translation in the file ./po/fr.po:
msgid "invalid option \"warning.expression\""
msgstr "option incorrecte \"warning.expression\""
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...
> gettext("Error in ", domain="R")
 "Error in "
> "invalid option \"warning.expression\"" -> msg; gettext(msg, domain="R")
 "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")?
More information about the R-help