Main index | Section 3 | 日本語 | Options |
#include <locale.h>
The setlocale() function recognizes several categories of routines. These are the categories and the sets of routines they select:
LC_ALL | Set the entire locale generically. |
LC_COLLATE | Set a locale for string collation routines. This controls alphabetic ordering in strcoll() and strxfrm(). |
LC_CTYPE | Set a locale for the ctype(3) and multibyte(3) functions. This controls recognition of upper and lower case, alphabetic or non-alphabetic characters, and so on. |
LC_MESSAGES | |
Set a locale for message catalogs, see catopen(3) function. | |
LC_MONETARY | |
Set a locale for formatting monetary values; this affects the localeconv() function. | |
LC_NUMERIC | Set a locale for formatting numbers. This controls the formatting of decimal points in input and output of floating point numbers in functions such as printf() and scanf(), as well as values returned by localeconv(). |
LC_TIME | Set a locale for formatting dates and times using the strftime() function. |
LANG | Sets the generic locale category for native language, local customs and coded character set in the absence of more specific locale variables. |
Only three locales are defined by default, the empty string amp;"" which denotes the native environment, and the amp;"C" and amp;"POSIX" locales, which denote the C language environment. A locale argument of NULL causes setlocale() to return the current locale.
The option
By default, C programs start in the amp;"C" locale.
The only function in the library that sets the locale is setlocale(); the locale is never changed as a side effect of some other routine.
setlocale(LC_ALL, "de"); setlocale(LC_COLLATE, "fr");
When a process is started, its current locale is set to the C or POSIX locale. An internationalized program that depends on locale data not defined in the C or POSIX locale must invoke the setlocale subroutine in the following manner before using any of the locale-specific information:
setlocale(LC_ALL, "");
$PATH_LOCALE/ locale/category
/usr/share/locale/ locale/category | |
locale file for the locale locale and the category category. | |
SETLOCALE (3) | August 7, 2020 |
Main index | Section 3 | 日本語 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.