[Rd] translation domain is wrong in stopifnot()?
Martin Maechler
m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Wed Dec 2 13:09:20 CET 2020
>>>>> Gábor Csárdi
>>>>> on Tue, 1 Dec 2020 23:48:37 +0000 writes:
> I don't know if this would be considered a bug in either stopifnot()
> or (n)gettext(), or not a bug at all, but sometimes the translation
> domain is not set properly for stopifnot() messages, so they won't be
> translated. E.g.
> Sys.setenv(LANGUAGE = "de")
> # This is good
> stopifnot(FALSE)
> #> Fehler: FALSE ist nicht TRUE
> f <- function() stopifnot(FALSE)
> # This is not
> f()
> #> Fehler in f() : FALSE is not TRUE
> Gabor
or even just directly :
> (function() stopifnot(1))()
Fehler in (function() stopifnot(1))() : 1 is not TRUE
I agree there is a bug.
The problem is that the default for the optional 'domain'
argument does not "work" correctly in the 2nd case.
I've checked that this can be worked around if I explicitly add
, domain = "R-base"
to the ngettext() call [ and also the gettext() call above ] .
Then I do get
> (function() stopifnot(1))()
Fehler in (function() stopifnot(1))() : 1 ist nicht TRUE
>
For now I'd claim the bug is in the underlying C code of
gettext() , ngettext() ...
It would we good to report this in R's bugzilla, please,
see https://www.r-project.org/bugs.html
Martin
More information about the R-devel
mailing list