[Rd] Testing for English locale

Simon Urbanek simon.urbanek at r-project.org
Mon Aug 1 17:35:43 CEST 2005


On Aug 1, 2005, at 10:20 AM, John Fox wrote:

> Is there a platform-independent way to test whether R is running in  
> an English locale?

I suppose the following should work:

Sys.getlocale("LC_CTYPE")=="C" || length(grep("^en",Sys.getlocale 
("LC_CTYPE"),TRUE))>0

Basically unix platforms will have "C" or "en_..."; Windows has  
"English...". You could make the check more strict depending on the  
platform if desired ..

Cheers,
Simon



More information about the R-devel mailing list