Skip to content
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

Align with withr::local_language() from dev withr #1879

Merged
merged 6 commits into from
Oct 28, 2024
Merged

Align with withr::local_language() from dev withr #1879

merged 6 commits into from
Oct 28, 2024

Conversation

krlmlr
Copy link
Member

@krlmlr krlmlr commented Oct 8, 2023

Closes #1925

@krlmlr krlmlr requested a review from lionel- October 8, 2023 20:12
@krlmlr
Copy link
Member Author

krlmlr commented Oct 8, 2023

Confirming that this fixes my problems with dev withr: r-dbi/RMariaDB@9e1f5d1.

I wonder why testthat's own tests fail now.

@lionel-
Copy link
Member

lionel- commented Oct 9, 2023

Maybe you need to adjust the tests like this? r-lib/withr@08619ef

@krlmlr
Copy link
Member Author

krlmlr commented Oct 9, 2023

Tried a moonshot, but could you please take this on (fixing tests if needed, NEWS, ...)?

R/local.R Outdated Show resolved Hide resolved
@hadley hadley requested a review from lionel- February 13, 2024 13:24
@hadley
Copy link
Member

hadley commented Feb 13, 2024

@lionel- can you take another look at this please?

R/local.R Outdated
@@ -133,8 +133,10 @@ local_reproducible_output <- function(width = 80,
.local_envir = .env
)

if (isTRUE(capabilities("NLS")) && Sys.getenv("LANG") != "C") {
withr::local_language(lang, .local_envir = .env)
if (isTRUE(capabilities("NLS"))) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we also bump version in DESCRIPTION?

Copy link
Member

Choose a reason for hiding this comment

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

yep good idea

@lionel-
Copy link
Member

lionel- commented Oct 23, 2024

Should also mention in @param lang that LC_ALL or LANG should be set to something other than "C", which is the default in testthat environment.

I wonder if we should just deprecate that argument though. It seems impractical to use.

@lionel- lionel- force-pushed the f-dev-withr branch 3 times, most recently from bc448a9 to f3ad181 Compare October 28, 2024 11:04
@lionel-
Copy link
Member

lionel- commented Oct 28, 2024

I now think:

  1. testthat should set LANGUAGE to "C" (undocumented unless I missed it but from reading gettext's source code that will work, see guess_category_value() in https://github.com/autotools-mirror/gettext/blob/fb38661cab30b40b503b55ac8dedcc2a8994932f/gettext-runtime/intl/dcigettext.c#L1465).

  2. withr should never warn when LANGUAGE is set to "C".

(1) is now implemented here and I've sent a patch release of withr to CRAN with (2).

@hadley
Copy link
Member

hadley commented Oct 28, 2024

I'll merge this once withr is on CRAN and we can bump the requirement here.

For `withr::local_language("C")` support

3.0.2 never warns when set to `"C"`
@lionel- lionel- merged commit 41442ac into main Oct 28, 2024
13 checks passed
@lionel- lionel- deleted the f-dev-withr branch October 28, 2024 14:55
@lionel-
Copy link
Member

lionel- commented Oct 28, 2024

withr is on CRAN and I've bumped the dep before merging.

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.

Changing language has no effect when envvar LC_ALL='C.UTF-8'
3 participants