locales                 package:base                 R Documentation

_Q_u_e_r_y _o_r _S_e_t _A_s_p_e_c_t_s _o_f _t_h_e _L_o_c_a_l_e

_D_e_s_c_r_i_p_t_i_o_n:

     Get details of or set aspects of the locale for the R process.

_U_s_a_g_e:

     Sys.getlocale(category = "LC_ALL")
     Sys.setlocale(category = "LC_ALL", locale = "")

_A_r_g_u_m_e_n_t_s:

category: character string. Must be one of '"LC_ALL"', '"LC_COLLATE"',
          '"LC_CTYPE"', '"LC_MONETARY"', '"LC_NUMERIC"' or '"LC_TIME"'.

  locale: character string.  A valid locale name on the system in use.
          Normally '""' (the default) will pick up the default locale
          for the system.

_D_e_t_a_i_l_s:

     The locale describes aspects of the internationalization of a
     program. Initially most aspects of the locale of R are set to
     '"C"' (which is the default for the C language and reflects
     North-American usage). R sets '"LC_CTYPE"' and '"LC_COLLATE"',
     which allow the use of a different character set and alphabetic
     comparisons in that character set (including the use of 'sort'),
     '"LC_MONETARY"' (for use by 'Sys.localeconv') and '"LC_TIME"' may
     affect the behaviour of 'as.POSIXlt' and 'strptime' and functions
     which use them (but not 'date').

     R can be built with no support for locales, but it is normally
     available on Unix and is available on Windows.

     Some systems will have other locale categories, but the six
     described here are those specified by POSIX.

     Note that setting '"LC_ALL"' as from R 2.1.0 sets only
     '"LC_COLLATE"', '"LC_CTYPE"', '"LC_MONETARY"' and '"LC_TIME"'.

_V_a_l_u_e:

     A character string of length one describing the locale in use
     (after setting for 'Sys.setlocale'), or an empty character string
     if the locale is invalid (with a warning) or 'NULL' if locale
     information is unavailable.

     For 'category = "LC_ALL"' the details of the string are
     system-specific: it might be a single locale or a set of locales
     separated by '"/"' (Solaris) or '";"' (Windows).  For portability,
     it is best to query categories individually.  It is guaranteed
     that the result of 'foo <- Sys.getlocale()' can be used in
     'Sys.setlocale("LC_ALL", locale = foo)' on the same machine.

_W_a_r_n_i_n_g:

     Setting '"LC_NUMERIC"' may cause R to function anomalously, so
     gives a warning.  (The known problems are with input conversion in
     locales with ',' as the decimal point.) Setting it temporarily to
     produce graphical or text output may work well enough.

_S_e_e _A_l_s_o:

     'strptime' for uses of 'category = "LC_TIME"'. 'Sys.localeconv'
     for details of numerical and monetary representations.

_E_x_a_m_p_l_e_s:

     Sys.getlocale()
     Sys.getlocale("LC_TIME")
     ## Not run: 
     Sys.setlocale("LC_TIME", "de")     # Solaris: details are OS-dependent
     Sys.setlocale("LC_TIME", "German") # Windows
     ## End(Not run)

     Sys.setlocale("LC_COLLATE", "C")  # turn off locale-specific sorting

