From 5a6206d79d4ba28a8d3717d822bfd024af5e9c84 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Tue, 4 Sep 2018 17:32:14 +0200 Subject: [PATCH] library/roles/R/templates/Rprofile.site.j2: Set the R locale inherithing the system one. See https://support.d4science.org/issues/12227 --- R/templates/Rprofile.site.j2 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/R/templates/Rprofile.site.j2 b/R/templates/Rprofile.site.j2 index 3a6136d4..b2124d07 100644 --- a/R/templates/Rprofile.site.j2 +++ b/R/templates/Rprofile.site.j2 @@ -8,6 +8,15 @@ # NOTE: managed by ansible # local({r <- getOption("repos") - r["CRAN"] <- "{{ r_cran_mirror_site }}" - options(repos=r) + r["CRAN"] <- "{{ r_cran_mirror_site }}" + options(repos=r) }) + +# Explicitly set the R encoding using the system one, if it exists +if (file.exists("/etc/default/locale")) { + readRenviron("/etc/default/locale") + LANG <- Sys.getenv("LANG") + if(nchar(LANG)) + Sys.setlocale("LC_ALL", LANG) +} +