Hi Brian, I appreciate your clarifications. I am sending this reply to the R-devel, as per you suggestion.
As mentioned in my post, I have no prior experience with this R function and logically, I looked up its help page, which states: > Conventionally the domain for *R* warning/error messages in package > pkg is |"R-pkg"|, and that for C-level messages is |"pkg"|. While it certainly mentions messages in the C-realm, it does not state that they cannot be translated using gettext(). This is less than obvious and could perhaps be explicitly stated. If gettext() cannot be used to get the translation for the "Error in " message in some supported language, then is there an alternative? Best, Florent On 04/02/13 18:27, Prof Brian Ripley wrote: > The 'wierdness' is that 'R' is a domain of C messages and you are > trying to use it from R. How messages are massaged before being sent > for translation depends on the language, including how trailing spaces > are handled. There is no reason to expect domains intended for C > code to work in R-level gettext(), nor in stop() etc. > > This was really an R-devel question: see the posting guide. > > On Mon, 4 Feb 2013, Florent Angly wrote: > >> 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 >> >> ______________________________________________ >> r-h...@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel