Skip to content

Set language to English#1258

Merged
hadley merged 7 commits intomasterfrom
lang-en
Dec 3, 2020
Merged

Set language to English#1258
hadley merged 7 commits intomasterfrom
lang-en

Conversation

@hadley
Copy link
Copy Markdown
Member

@hadley hadley commented Dec 2, 2020

@MichaelChirico does this seem ok to you? (Since you're the only person I know who's testing translations). R CMD check already sets the language to English so we don't think this should affect much existing code.

Fixes #1213

@hadley hadley requested a review from gaborcsardi December 2, 2020 19:12
Comment thread R/local.R
withr::local_envvar(RSTUDIO = NA, .local_envir = .env)
withr::local_envvar(
RSTUDIO = NA,
LANGUAGE = "en",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we include a sentence about this in the list of things local_test_context() sets, up about line 44?

Btw. that line also needs a fix for RSTUDIO, which is now unset.

@MichaelChirico
Copy link
Copy Markdown
Contributor

IINM it will work on Unix, but probably (?) not on Windows (though I do see a ✅ for the Windows GHA). We had some headaches getting non-English tests to work on Windows... see Rdatatable/data.table#4524.

I'm not sure if it's any easier a problem to specifically force English than it was for us to temporarily set Chinese.

For reference I think you're referring to this from WRE 1.3.1:

All these tests are run with collation set to the C locale, and for the examples and tests with environment variable LANGUAGE=en: this is to minimize differences between platforms.

There's also this in R administration 2.8 about testing R installation:

Sys.setenv(LC_COLLATE = "C", LC_TIME = "C", LANGUAGE = "en")

And I think our troubles were related to this note in R administration 7.2:

It is usually possible to change the language once R is running via (not Windows) Sys.setlocale("LC_MESSAGES", "new_locale"), or by setting an environment variable such as LANGUAGE, provided34 the language you are changing to can be output in the current character set. But this is OS-specific, and has been known to stop working on an OS upgrade.

@hadley
Copy link
Copy Markdown
Member Author

hadley commented Dec 2, 2020

I also have a vague recollection that the translation is cached, so that after an error message has been processed once, changing LANG doesn't have any effect.

@hadley
Copy link
Copy Markdown
Member Author

hadley commented Dec 2, 2020

Running the testthat revdeps now, just to double check that this won't accidentally break anything.

@hadley
Copy link
Copy Markdown
Member Author

hadley commented Dec 3, 2020

I individually checked the four failures — they seem unrelated to the language setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parallel tests use different language

3 participants