[Rd] translation domain is wrong in stopifnot()?

Gábor Csárdi c@@rd|@g@bor @end|ng |rom gm@||@com
Wed Dec 2 19:53:56 CET 2020


Bug report: https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17998

Gabor

On Wed, Dec 2, 2020 at 12:09 PM Martin Maechler
<maechler using stat.math.ethz.ch> wrote:
>
> >>>>> 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