Rev 26077 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{locales}\alias{locales}\alias{Sys.getlocale}\alias{Sys.setlocale}\title{Query or Set Aspects of the Locale}\description{Get details of or set aspects of the locale for the \R process.}\usage{Sys.getlocale(category = "LC_ALL")Sys.setlocale(category = "LC_ALL", locale = "")}\arguments{\item{category}{character string. Must be one of \code{"LC_ALL"},\code{"LC_COLLATE"}, \code{"LC_CTYPE"}, \code{"LC_MONETARY"},\code{"LC_NUMERIC"} or \code{"LC_TIME"}.}\item{locale}{character string. A valid locale name on the system inuse. Normally \code{""} (the default) will pick up the defaultlocale for the system.}}\details{The locale describes aspects of the internationalization of a program.Initially most aspects of the locale of \R are set to \code{"C"} (whichis the default for the C language and reflects North-American usage).\R does set \code{"LC_CTYPE"} and \code{"LC_COLLATE"}, which allow theuse of a different character set (typically ISO Latin 1) and alphabeticcomparisons in that character set (including the use of\code{\link{sort}}) and \code{"LC_TIME"} may affectthe behaviour of \code{\link{as.POSIXlt}} and \code{\link{strptime}}and functions which use them (but not \code{\link{date}}).\R can be built with no support for locales, but it is normallyavailable on Unix and is available on Windows.Some systems will have other locale categories, but the six describedhere are those specified by POSIX.}\value{A character string of length one describing the locale in use (aftersetting for \code{Sys.setlocale}), or an empty character string if thelocale is invalid (with a warning) or \code{NULL} if localeinformation is unavailable.For \code{category = "LC_ALL"} the details of the string aresystem-specific: it might be a single locale or a set of localesseparated by \code{"/"} (Solaris) or \code{";"} (Windows). Forportability, it is best to query categories individually. It isguaranteed that the result of \code{foo <- Sys.getlocale()} can beused in \code{Sys.setlocale("LC_ALL", locale = foo)} on the samemachine.}\section{Warning}{Setting \code{"LC_NUMERIC"} can produce output that \R cannot thenread by \code{scan} or \code{read.table} with their default arguments,which are not locale-specific.}\seealso{\code{\link{strptime}} for uses of \code{category = "LC_TIME"}.\code{\link{Sys.localeconv}} for details of numerical representations.}\examples{Sys.getlocale()Sys.getlocale("LC_TIME")\dontrun{Sys.setlocale("LC_TIME", "de") # Solaris: details are OS-dependentSys.setlocale("LC_TIME", "German") # Windows}Sys.setlocale("LC_COLLATE", "C") # turn off locale-specific sorting}\keyword{utilities}