From bc448a92e097a3dfc978a7d589c340a194a5e057 Mon Sep 17 00:00:00 2001 From: Lionel Henry Date: Mon, 28 Oct 2024 11:50:02 +0100 Subject: [PATCH] Set `LANGUAGE` to `"C"` --- NEWS.md | 4 ++++ R/local.R | 9 ++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/NEWS.md b/NEWS.md index 6eb90a984..164a3df9c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # testthat (development version) +* `LANGUAGE` is now set to `"C"` in reprocucible environments (i.e. + `test_that()` blocks) to disable translations. This fixes warnings + about being unable to set the language to `"en"` (#1925). + # testthat 3.2.1 * Fix incorrect format string detected by latest R-devel. Fix thanks to diff --git a/R/local.R b/R/local.R index 2666822ae..b8693bab0 100644 --- a/R/local.R +++ b/R/local.R @@ -98,7 +98,7 @@ local_reproducible_output <- function(width = 80, unicode = FALSE, rstudio = FALSE, hyperlinks = FALSE, - lang = "en", + lang = "C", .env = parent.frame()) { if (unicode) { @@ -133,12 +133,7 @@ local_reproducible_output <- function(width = 80, .local_envir = .env ) - if (isTRUE(capabilities("NLS"))) { - suppressWarnings( - withr::local_language(lang, .local_envir = .env) - ) - } - + withr::local_language(lang, .local_envir = .env) withr::local_collate("C", .local_envir = .env) }