skip_if_localized() #565
Closed
skip_if_localized() #565
Labels
Comments
Or we could add a language parameter to |
Hmmm, how do we know if you're localised? |
Maybe |
This should be better I guess: https://github.com/wch/r-source/blob/0af92cb369681f3ef666451a6eeb895988c04113/tests/reg-tests-1d.R#L13-L29 |
Something like is_english <- function() {
lang <- Sys.getenv("LANGUAGE")
if (identical(lang, "en")) {
return(TRUE)
}
if(.Platform$OS.type == "windows") {
lc <- sub("\\..*", "", sub("_.*", "", Sys.getlocale("LC_CTYPE")))
lc == "English" || lc == "C"
} else {
lc <- sub("\\..*", "", Sys.getlocale("LC_MESSAGES"))
lc == "C" || substr(lc, 1, 2) == "en"
}
} |
We need a different name because of localized vs localised. Maybe |
This feels awkward - I'd rather add a lang parameter to |
Unfortunately it looks like that gettext caches translations between calls making it difficult to switch languages back and forth in a single session. I'll go back to |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to be able to skip tests that check the wording of an error message and fail in a non-English locale.
The text was updated successfully, but these errors were encountered: