[Rd] Internationalization questions
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Aug 22 08:47:13 CEST 2005
On Sun, 21 Aug 2005, John Fox wrote:
> Dear R-devel list members:
>
> I have two internationalization questions, related to questions that I posed
> previously. These pertain to Windows (I've tried under Win XP but assume the
> issue is more general) and R 2.1.1 patched and 2.2.0 devel.
>
> (1) I've noticed that the standard Windows dialogs in R -- whether initiated
> from the Rgui menus, from winDialog(), or from tcltk functions such as
> tkmessageBox() -- do not have button labels translated when running in a
> non-English locale. For example, when running in a French locale, the
> command
>
> winDialog(type="yesnocancel", message=gettext("Save workspace image?",
> domain="RGui"))
>
> produces a dialog box with the message translated to "Sauver une image de la
> session?", but the buttons still read "Yes", "No", and "Cancel".
>
> Is this the intended behaviour? Is there any way to get the button text
> translated? I've implemented a partial solution that uses a substitute for
> tkmessageBox(), but it is a bit awkward.
You need to have Windows set to be in French dialogs, not just the locale
set to French. This is on the second page of the Regional settings
doalogs in WinXP. It is intended, as it makes all Windows dialogs work
consistently. (You can have different settings on the three pages, but
not all combinations work successfully -- the current rw-FAQ has some
comments.)
> (2) I'm still looking for a reliable way to determine whether R is using
> English. Currently, I have the function
>
> English <- function() {
> env <- Sys.getenv()
> names(env) <- toupper(names(env))
> LANG <- env["LANGUAGE"]
> LC_CTYPE <- Sys.getlocale("LC_CTYPE")
> if (!is.na(LANG)) length(grep("^en", LANG, ignore.case=TRUE)) > 0
> else LC_CTYPE == "C" || length(grep("^en", LC_CTYPE, ignore.case=TRUE))
>> 0
> }
>
>
> (adapting and extending a suggestion by Simon Urbanek) which checks not just
> the locale but also for an environment variable named LANGUAGE. Is this
> sufficient?
Using English for what? (See my comments above.) For messages, yes, it
covers all the quirks we know about in the major OSes.
Brian
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list