Learn R Programming

assertive (version 0.2-6)

sys_get_locale: Get or set the system locale

Description

Wrappers to Sys.getlocale and Sys.setlocale for getting and setting the system locale.

Usage

sys_get_locale(simplify = FALSE)

sys_set_locale(..., l = list())

Arguments

simplify
If TRUE, the locale settings are returned as a vector, otherwise, a list.
...
Name-value pairs of locale categories to set.
l
A list, as an alternative method of passing local categories to set.

Value

  • A named list or vector giving the system locale names.

See Also

Sys.getlocale.

Examples

Run this code
(current_locale <- sys_get_locale())
english <- if(is_windows()) "English"
  else if(is_mac()) "en_GB"
  else if(is_linux()) "en_GB.utf8"
  else "en"
sys_set_locale(LC_MONETARY = english)
sys_get_locale()
sys_set_locale(l = current_locale)  #restore everything

Run the code above in your browser using DataLab