-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
is_english not catching non-English machine #879
Comments
Proposal -- replace
|
Can you please provide the results of |
It's Here's
Screencap of |
But you don't have |
The source itself (I think), is at https://github.com/wch/r-source/blob/5a156a0865362bb8381dcd69ac335f5174a4f60c/src/extra/intl/dcigettext.c#L1508-L1520 |
I also poked around the https://www.gnu.org/software/gettext/manual/gettext.html#Setting-the-POSIX-Locale |
After reading the source, I think what happens is that if The problem with using your This makes me think that But what should we suggest instead? I think the context is usually checking that your code throws the expected base R error (e.g. #565, Rdatatable/data.table#3039), so I think the best thing is to probably use msg <- sprintf(gettext("'%s' not found", domain = "R"), "is_english")
expect_error(is_english(), msg) I don't see any obvious way to automate this, so I think all we can do is document. I wonder if R-core might be persuaded to add a new field to base conditions that would contain the untranslated error message? Alternatively, a class hierarchy for conditions could also solve the same problem in a different way (since you'd be able to test for the class rather than the error message text). |
Actually, maybe skip_if_translated <- function(message = "'%s' not found") {
if (gettext(message, domain = "R") == message) {
return(invisible(TRUE))
}
skip(paste0("'", message, "' is translated"))
} |
We wound up doing the following in https://github.com/Rdatatable/data.table/blob/master/R/test.data.table.R#L65-L72
And unfortunately, my machine that led to this issue was recently decommissioned so I'm afraid I won't be of help to confirm any fix :\ |
With info:
Now for the
testthat
part:i.e., since
is_english()
will evaluate toTRUE
inskip_if_translated()
, it won't be possible to skip thegettext
-produced error found here.The text was updated successfully, but these errors were encountered: