with_language: Language

View source: R/language.R

with_languageR Documentation

Language

Description

Temporarily change the language used for translations.

Usage

with_language(lang, code)

local_language(lang, .local_envir = parent.frame())

Arguments

lang

A BCP47 language code like "en" (English), "fr" (French), "fr_CA" (French Canadian). Formally, this is a lower case two letter ISO 639 country code, optionally followed by "_" or "-" and an upper case two letter ISO 3166 region code.

code

[any]
Code to execute in the temporary environment

.local_envir

⁠[environment]⁠
The environment to use for scoping.

Examples

with_language("en", try(mean[[1]]))
with_language("fr", try(mean[[1]]))
with_language("es", try(mean[[1]]))

r-lib/withr documentation built on Feb. 2, 2024, 2:03 a.m.