| locale(7) | Miscellaneous Information Manual | locale(7) |
locale - opis obsługi wielu języków
#include <locale.h>
Locale to zestaw reguł językowych i kulturalnych. Obejmują one aspekty takie, jak język komunikatów, różne zestawy znaków, konwencje leksykograficzne itd. Program musi umieć określić swoje locale i zachowywać się odpowiednio, aby można go było przenieść do innych kultur.
The header <locale.h> declares data types, functions, and macros which are useful in this task.
Funkcje deklarowane to setlocale(3), ustawiająca bieżące locale, i localeconv(3), pobierająca informacje o formatowaniu liczb.
Istnieją różne kategorie informacji regionalnych, których potrzebować może program; zadeklarowane są one jako makra. Używając ich jako pierwszego argumentu funkcji setlocale(3), możliwe jest ustawienie poniższych informacji regionalnych:
If the second argument to setlocale(3) is an empty string, "", for the default locale, it is determined using the following steps:
Wartości dotyczące lokalnego formatowania dostępne są w strukturze lconv, zwracanej przez funkcję localeconv(3). lconv ma następującą deklarację:
struct lconv {
/* Informacja numeryczna (niewalutowa) */
char *decimal_point; /* Radix character */
char *thousands_sep; /* Separator for digit groups to left
of radix character */
char *grouping; /* Each element is the number of digits in
a group; elements with higher indices
are further 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 further left. */
/* Pozostałe pola zawierają informacje o walucie */
char *int_curr_symbol; /* First three chars are a currency
symbol from ISO 4217. Fourth char
is the separator. Fifth char
is '\0'. */
char *currency_symbol; /* Local currency symbol */
char *mon_decimal_point; /* Radix character */
char *mon_thousands_sep; /* Like thousands_sep above */
char *mon_grouping; /* Like grouping above */
char *positive_sign; /* Sign for positive values */
char *negative_sign; /* Sign for negative values */
char int_frac_digits; /* International fractional digits */
char frac_digits; /* Local fractional digits */
char p_cs_precedes; /* 1 if currency_symbol precedes a
positive value, 0 if succeeds */
char p_sep_by_space; /* 1 if a space separates
currency_symbol from a positive
value */
char n_cs_precedes; /* 1 if currency_symbol precedes a
negative value, 0 if succeeds */
char n_sep_by_space; /* 1 if a space separates
currency_symbol from a negative
value */
/* 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;
};
POSIX.1-2008 standardized a number of extensions to the locale API, based on implementations that first appeared in glibc 2.3. These extensions are designed to address the problem that the traditional locale APIs do not mix well with multithreaded applications and with applications that must deal with multiple locales.
Rozszerzenia zajmują się formą nowych funkcji do tworzenia i działania na obiektach locale (newlocale(3), freelocale(3), duplocale(3) i uselocale(3)) oraz różnymi nowymi funkcjami bibliotycznymi z przyrostkiem "_l" (np. toupper_l(3)), które rozszerzają tradycyjne, zależne od ustawień regionalnych API (np. toupper(3)) pozwalając na określenie obiektu locale który ma zostać zastosowany przy wykonywaniu funkcji.
Następujące zmienne środowiskowe są używane przez newlocale(3) i setlocale(3) wpływając na wszystkie nieuprzywilejowane zlokalizowane programy:
POSIX.1-2001.
iconv(1), locale(1), localedef(1), catopen(3), gettext(3), iconv(3), localeconv(3), mbstowcs(3), newlocale(3), ngettext(3), nl_langinfo(3), rpmatch(3), setlocale(3), strcoll(3), strfmon(3), strftime(3), strxfrm(3), uselocale(3), wcstombs(3), locale(5), charsets(7), unicode(7), utf-8(7)
Autorami polskiego tłumaczenia niniejszej strony podręcznika są: Gwidon S. Naskrent <naskrent@hoth.amu.edu.pl>, Robert Luberda <robert@debian.org> i Michał Kułach <michal.kulach@gmail.com>
Niniejsze tłumaczenie jest wolną dokumentacją. Bliższe informacje o warunkach licencji można uzyskać zapoznając się z GNU General Public License w wersji 3 lub nowszej. Nie przyjmuje się ŻADNEJ ODPOWIEDZIALNOŚCI.
Błędy w tłumaczeniu strony podręcznika prosimy zgłaszać na adres listy dyskusyjnej manpages-pl-list@lists.sourceforge.net.
| 5 lutego 2023 r. | Linux man-pages 6.03 |