argh icon indicating copy to clipboard operation
argh copied to clipboard

lang params use Sys.getenv("LANGUAGE") result?

Open mrchypark opened this issue 6 years ago • 3 comments

how about use lang params Sys.getenv("LANGUAGE") ??

mrchypark avatar Mar 30 '19 16:03 mrchypark

That would work, but on a general basis, I prefer not to mess with environment variables :)

Any reason this would be better than the current implementation?

ColinFay avatar Apr 08 '19 19:04 ColinFay

Sys.getenv("LANGUAGE") is already used variables. that's why I suggest.

mrchypark avatar Apr 09 '19 02:04 mrchypark

Ah, that makes sense indeed!

I thought you were suggesting to ask the user to set an environment variable or to set a variable with a function.

We should make it optional though, I'm not sure it's set on every machine.

get_sys_lang <- function(){
  if (!is.null(Sys.getenv("LANG")) && Sys.getenv("LANG")  != ""){
    gsub("([^\\.]*)\\..*", "\\1", Sys.getenv("LANG"))
  } else {
    invisible(NULL)
  }

Also, it should also be possible for the user to prevent the use of the env variable

ColinFay avatar Apr 09 '19 08:04 ColinFay