diff --git a/R/Utils.R b/R/Utils.R index 0b9e988db9d59b71c90e735bc1d3e2a9c029573b..82c66da0d6410fa7e5747985c73fc44f860836a7 100644 --- a/R/Utils.R +++ b/R/Utils.R @@ -232,3 +232,27 @@ NextMethod() } } + + + +## ================================================================================= +## function to try to set local time in English +## ================================================================================= + +.TrySetLcTimeEN <- function() { + locale <- list("English_United Kingdom", + "en_US", + "en_US.UTF-8", + "en_US.utf8", + "en") + dateTest <- as.POSIXct("2000-02-15", tz = "UTC", format = "%Y-%m-%d") + monthTestTarget <- "February" + monthTest <- function() { + format(dateTest, format = "%B") + } + lapply(locale, function(x) { + if (monthTest() != monthTestTarget) { + Sys.setlocale(category = "LC_TIME", locale = x) + } + }) +}