From simon.urbanek at r-project.org  Mon Aug  1 17:35:43 2005
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Mon, 1 Aug 2005 11:35:43 -0400
Subject: [Rd] Testing for English locale
In-Reply-To: <20050801142041.KCML26102.tomts10-srv.bellnexxia.net@JohnDesktop8300>
References: <20050801142041.KCML26102.tomts10-srv.bellnexxia.net@JohnDesktop8300>
Message-ID: <AB974D83-2494-48BD-9A7F-1BC134BE81FE@r-project.org>

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



[Rd] Testing for English locale
Simon Urbanek