, . , , , . , , , , .
, , , . ; , , , .
, . .
c : localization internationalization. , . . , - //. - ... , . , - , : "" () . , .
( i18n ), , , , .
, , .
, ; .
, . , .
- locale. locale , . , locale , . , locale- / / . , / - / / , / - / / .
// , .
locale - , , , :
- www.sensi.org/~alec/locale , (, ..)
( glibc):
:
/usr/share/locale
ru_RU.KOI8-R,
ru_SU.
glibc < 2.1.2.
/etc/sysconfig/i18n
, ,
LANG=ru_RU.KOI8-R
/etc/profile
LANG=<-->. export LANG
:
/usr/share/locale/ru_RU.KOI8-R/
(
).
LANG=ru LC_ALL=ru_RU.KOI8-R
- .
, :
?
UNIX ( POSIX:1996) locale , LANG:
$ export LANG={}
,
: LANG="C"
LANG="POSIX"
( ) - ,
ANSI C (ISO 9899:1990),
US-ASCII (7 bit) (
Portable Character Set).
POSIX.2,
LANG=
locale
:
$ locale -a
(POSIX.2 E (?)) :
language_TERRITORY.Codeset
:
language[_TERRITORY[.Codeset[@modyfier]]]
ISO 639
"language names",
ISO 3166
- "territory names". _SU
( ),
alias : ru_SU --> ru_RU
.
LANG
, ,
LANG="ru_RU.KOI8-R"
LANG="ru_RU.ISO_8859-5"
. :
$ export LANG="ru_RU.KOI8-R"
locale
,
aliases
() .
"C" --> "POSIX"
.
$ export LANG=ru $ export LANG=ru_RU $ export LANG=ru_RU.KOI8-R
FreeBSD 2.x . Linux - . (Solaris, SCO, AIX e.t.c.) LANG="ru_RU", LANG="ru" ( Codeset ISO8859-5 ).
:
ru_RU.X-CP-866
(ru_RU.IBM866
), ru_RU.x-mac-cyrillic
,
ru_RU.ISO_8859-5
ru_RU.CP1251
-
.
( x-mac-cyrillic
) IANA.
, , -
- .
( export LANG={}
) ,
locale locale API
libc
, .
,
:
, man-, .., :
$ export LANG="C" $ export LC_CTYPE="ru_RU.KOI8-R" $ export LC_COLLATE="ru_RU.KOI8-R" $ export LC_TIME="C"
:
$ export LC_ALL={}
,
"" " ".
locale API
.
,
PostScript
: LC_NUMERIC
ru_RU
'' : "," ,
PostScript : "." LC_NUMERIC
printf("%f",float);
.
C (POSIX)
LC_NUMERIC
, PostScript
:
$ export LC_NUMERIC="POSIX"
locale ( ).
$ locale
: UNICODE. LANG="ru_RU.UTF-8" .
RedHat Linux (, , Linux),
locale: C (libc
), - X
.
locale .
locale ,
LANG
. ,
sh
:
LANG=ru_SU export LANG
,
date
. ,
.
RedHat 5.x KOI8-R locale ru_SU
.
ru_RU
locale, iso-8859-5
.
locale
. , (
) ru_SU
locale,
POSIX .
, ,
locale. ,
:
LANG=ru_SU LC_NUMERIC=POSIX export LANG LC_NUMERIC
. locale(7)
.
Linux.
, Linux libc
5.3.12 (:
RedHat 4.1), locale.
Interneta (, , ).
, locale,
'locale -a
'. locale ,
libc.
X
,
locale. XFree86 3.3
locale. ,
. ,
/usr/lib/X11/locale/
( ).
, koi8-r
iso8859-5
..
locale , . API, , locale. , locale - , locale ( ).
man setlocale(3)
:
locale,setlocale(LC_ALL, "" )
, ,localeconv()
locale -strcoll()
strxfrm()
.
:
setlocale()
. -
8- ,
ctype.h
limits.h
,
signed/unsigned
.
, -
.
:
if (c >= 'A' && c <= 'Z') { ...
ctype.h
.
:
if (isalpha(c) && isupper(c)) { ... if (isascii(c) && isupper(c))
strcoll()
strxfrm()
strcmp()
,
time()
, localtime()
, strftime()
, , localeconv()
.
gettext()
(Sun/POSIX ), catgets()
(X/Open ). .
i18n
.
char
. wchar_t
,
, ,
Unicode. ANSI C API.
, , ( Voropay1 ) ( SingleUnix ).
, , ( i18n ) - .
. ( ) . , , free !
GNU, ,
. Ulrich Drepper
(drepper@ipd.info.uni-karlsruhe.de
) gettext
.
GNU , ,
prep.ai.mit.edu.
,
.
, gettext
.
: gettext
GNU
, ! GNU
, locale .
,
( , ).
, : .po
, ,
.
, -,
! Ulrich
Drepper (
drepper@ipd.info.uni-karlsruhe.de).