r-devel / translations

subsite for translations
https://contributor.r-project.org/translations/
Creative Commons Attribution 4.0 International
1 stars 3 forks source link

create R helpers to temporarily switch to English (locale) #11

Open daroczig opened 1 year ago

daroczig commented 1 year ago

When using R in a non-English message, searching the Internet for the translated error messages is difficult. So we should provide helpers functions to let the users easily switch to English and back.

MichaelChirico commented 12 months ago

Is this for a context where withr::with_language() won't help?

LANGUAGE=de R
sum('a')
# Fehler in sum("a") : ungültiger 'type' (character) des Argumentes
withr::with_language('en', sum('a'))
# Error in sum("a") : invalid 'type' (character) of argument
aitap commented 12 months ago

See also: Sys.setLanguage() in recent versions of R: https://search.r-project.org/R/refmans/base/html/gettext.html