Copyright (C) 2000-2012 |
Manpages LOCALESection: Linux Programmer's Manual (7 )Updated: 1993-04-24 Index Return to Main Contents NAMElocale - Description of multi-language supportSYNOPSIS#include <locale.h> DESCRIPTIONA locale is a set of language and cultural rules. These cover aspects such as language for messages, different character sets, lexigraphic conventions, etc. A program needs to be able to determine its locale and act accordingly to be portable to different cultures.The header <locale.h> declares data types, functions and macros which are useful in this task. The functions it declares are setlocale() to set the current locale, and localeconv() to get information about number formatting. There are different categories for local information a program might need; they are declared as macros. Using them as the first argument to the setlocale() function, it is possible to set one of these to the desired locale:
If the second argument to setlocale() is empty string, , for the default locale, it is determined using the following steps:
Values about local numeric formatting is made available in a struct lconv returned by the localeconv() function, which has the following declaration: struct lconv { /* Numeric (non-monetary) information. */ char *decimal_point; /* Decimal point character. */ char *thousands_sep; /* Thousands separator. */ /* Each element is the number of digits in each group; elements with higher indices are farther left. An element with value CHAR_MAX means that no further grouping is done. An element with value 0 means that the previous element is used for all groups farther left. */ char *grouping; /* Monetary information. */ /* First three chars are a currency symbol from ISO 4217. Fourth char is the separator. Fifth char is ' '. */ char *int_curr_symbol; char *currency_symbol; /* Local currency symbol. */ char *mon_decimal_point; /* Decimal point character. */ char *mon_thousands_sep; /* Thousands separator. */ char *mon_grouping; /* Like `grouping' element (above). */ char *positive_sign; /* Sign for positive values. */ char *negative_sign; /* Sign for negative values. */ char int_frac_digits; /* Int'l fractional digits. */ char frac_digits; /* Local fractional digits. */ /* 1 if currency_symbol precedes a positive value, 0 if succeeds. */ char p_cs_precedes; /* 1 if a space separates currency_symbol from a positive value. */ char p_sep_by_space; /* 1 if currency_symbol precedes a negative value, 0 if succeeds. */ char n_cs_precedes; /* 1 if a space separates currency_symbol from a negative value. */ char n_sep_by_space; /* Positive and negative sign positions: 0 Parentheses surround the quantity and currency_symbol. 1 The sign string precedes the quantity and currency_symbol. 2 The sign string succeeds the quantity and currency_symbol. 3 The sign string immediately precedes the currency_symbol. 4 The sign string immediately succeeds the currency_symbol. */ char p_sign_posn; char n_sign_posn; }; CONFORMS TOPOSIX.1SEE ALSOsetlocale(3), localeconv(3), locale(1), localedef(1), rpmatch(3), strfmon(3), strcoll(3), strxfrm(3), strftime(3)
IndexThis document was created by man2html, using the manual pages. Time: 10:13:30 GMT, December 14, 2024 |