EVOLUTION-MANAGER
Edit File: locales.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Query or Set Aspects of the Locale</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for locales {base}"><tr><td>locales {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Query or Set Aspects of the Locale</h2> <h3>Description</h3> <p>Get details of or set aspects of the locale for the <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> process. </p> <h3>Usage</h3> <pre> Sys.getlocale(category = "LC_ALL") Sys.setlocale(category = "LC_ALL", locale = "") </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>category</code></td> <td> <p>character string. The following categories should always be supported: <code>"LC_ALL"</code>, <code>"LC_COLLATE"</code>, <code>"LC_CTYPE"</code>, <code>"LC_MONETARY"</code>, <code>"LC_NUMERIC"</code> and <code>"LC_TIME"</code>. Some systems (not Windows) will also support <code>"LC_MESSAGES"</code>, <code>"LC_PAPER"</code> and <code>"LC_MEASUREMENT"</code>. </p> </td></tr> <tr valign="top"><td><code>locale</code></td> <td> <p>character string. A valid locale name on the system in use. Normally <code>""</code> (the default) will pick up the default locale for the system.</p> </td></tr> </table> <h3>Details</h3> <p>The locale describes aspects of the internationalization of a program. Initially most aspects of the locale of <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> are set to <code>"C"</code> (which is the default for the C language and reflects North-American usage – also known as <code>"POSIX"</code>). <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> sets <code>"LC_CTYPE"</code> and <code>"LC_COLLATE"</code>, which allow the use of a different character set and alphabetic comparisons in that character set (including the use of <code><a href="sort.html">sort</a></code>), <code>"LC_MONETARY"</code> (for use by <code><a href="Sys.localeconv.html">Sys.localeconv</a></code>) and <code>"LC_TIME"</code> may affect the behaviour of <code><a href="as.POSIXlt.html">as.POSIXlt</a></code> and <code><a href="strptime.html">strptime</a></code> and functions which use them (but not <code><a href="date.html">date</a></code>). </p> <p>The first seven categories described here are those specified by POSIX. <code>"LC_MESSAGES"</code> will be <code>"C"</code> on systems that do not support message translation, and is not supported on Windows. Trying to use an unsupported category is an error for <code>Sys.setlocale</code>. </p> <p>Note that setting category <code>"LC_ALL"</code> sets only categories <code>"LC_COLLATE"</code>, <code>"LC_CTYPE"</code>, <code>"LC_MONETARY"</code> and <code>"LC_TIME"</code>. </p> <p>Attempts to set an invalid locale are ignored. There may or may not be a warning, depending on the OS. </p> <p>Attempts to change the character set (by <code>Sys.setlocale("LC_CTYPE", )</code>, if that implies a different character set) during a session may not work and are likely to lead to some confusion. </p> <p>Note that the <span class="env">LANGUAGE</span> environment variable has precedence over <code>"LC_MESSAGES"</code> in selecting the language for message translation on most <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> platforms. </p> <p>On platforms where ICU is used for collation the locale used for collation can be reset by <code><a href="icuSetCollate.html">icuSetCollate</a></code>. Except on Windows, the initial setting is taken from the <code>"LC_COLLATE"</code> category, and it is reset when this is changed by a call to <code>Sys.setlocale</code>. </p> <h3>Value</h3> <p>A character string of length one describing the locale in use (after setting for <code>Sys.setlocale</code>), or an empty character string if the current locale settings are invalid or <code>NULL</code> if locale information is unavailable. </p> <p>For <code>category = "LC_ALL"</code> the details of the string are system-specific: it might be a single locale name or a set of locale names separated by <code>"/"</code> (Solaris, macOS) or <code>";"</code> (Windows, Linux). For portability, it is best to query categories individually: it is not necessarily the case that the result of <code>foo <- Sys.getlocale()</code> can be used in <code>Sys.setlocale("LC_ALL", locale = foo)</code>. </p> <h3>Available locales</h3> <p>On most Unix-alikes the POSIX shell command <code>locale -a</code> will list the ‘available public’ locales. What that means is platform-dependent. On recent Linuxen this may mean ‘available to be installed’ as on some RPM-based systems the locale data is in separate RPMs. On Debian/Ubuntu the set of available locales is managed by OS-specific facilities such as <code>locale-gen</code> and <code>locale -a</code> lists those currently enabled. </p> <p>For Windows, Microsoft moves its documentation frequently so a Web search is the best way to find current information. </p> <h3>Warning</h3> <p>Setting <code>"LC_NUMERIC"</code> to any value other than <code>"C"</code> may cause <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> to function anomalously, so gives a warning. Input conversions in <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> itself are unaffected, but the reading and writing of ASCII <code><a href="save.html">save</a></code> files will be, as may packages which do their own input/output. </p> <p>Setting it temporarily on a Unix-alike to produce graphical or text output may work well enough, but <code><a href="options.html">options</a>(OutDec)</code> is often preferable. </p> <p>Almost all the output routines used by <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> itself under Windows ignore the setting of <code>"LC_NUMERIC"</code> since they make use of the Trio library which is not internationalized. </p> <h3>Note</h3> <p>Changing the values of locale categories whilst <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> is running ought to be noticed by the OS services, and usually is but exceptions have been seen (usually in collation services). </p> <h3>See Also</h3> <p><code><a href="strptime.html">strptime</a></code> for uses of <code>category = "LC_TIME"</code>. <code><a href="Sys.localeconv.html">Sys.localeconv</a></code> for details of numerical and monetary representations. </p> <p><code><a href="l10n_info.html">l10n_info</a></code> gives some summary facts about the locale and its encoding. </p> <p>The ‘R Installation and Administration’ manual for background on locales and how to find out locale names on your system. </p> <h3>Examples</h3> <pre> Sys.getlocale() Sys.getlocale("LC_TIME") ## Not run: Sys.setlocale("LC_TIME", "de") # Solaris: details are OS-dependent Sys.setlocale("LC_TIME", "de_DE") # Many Unix-alikes Sys.setlocale("LC_TIME", "de_DE.UTF-8") # Linux, macOS, other Unix-alikes Sys.setlocale("LC_TIME", "de_DE.utf8") # some Linux versions Sys.setlocale("LC_TIME", "German") # Windows ## End(Not run) Sys.getlocale("LC_PAPER") # may or may not be set ## Not run: Sys.setlocale("LC_COLLATE", "C") # turn off locale-specific sorting, # usually (but not on all platforms) ## End(Not run) </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>