.\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de) .\" and Copyright (C) 2014 Michael Kerrisk .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\" Modified Sat Jul 24 17:28:34 1993 by Rik Faith .\" Modified Sun Jun 01 17:16:34 1997 by Jochen Hein .\" .\" Modified Thu Apr 25 00:43:19 2002 by Bruno Haible .\" .\" FIXME Document LOCPATH; .\" see http://sourceware.org/bugzilla/show_bug.cgi?id=174 .\" Is removed for SUID/SGID programs (see sysdeps/generic/unsecvars.h) .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya .\" all rights reserved. .\" Translated Wed Dec 24 21:08:08 JST 1997 .\" by HANATAKA Shinya .\" Modified Thu 14 Nov 2002 by NAKANO Takeo .\" .TH LOCALE 7 2014\-03\-18 Linux "Linux Programmer's Manual" .SH 名前 locale \- 多言語サポートの解説 .SH 書式 .nf \fB#include \fP .fi .SH 説明 ロケール (locale) は言語や文化ルールの集合である。 これらは、メッセージ出力に使用する言語・いろいろな文字集合・ 表記に関する慣習といったような面をカバーしている。 プログラムをいろいろな文化に移植可能とするには、 そのプログラムは自分のロケールを決めて、 それに応じた適切な動作ができなければならない。 .PP ヘッダーファイル \fI\fP には、この目的に便利なデータ型・関数・マクロなどの宣言がある。 .PP このヘッダーファイルで宣言されている関数には、 現在のロケールを設定する \fBsetlocale\fP(3) と、数値のフォーマット方法についての情報を取得する \fBlocaleconv\fP(3) がある。 .PP プログラムの必要に応じて、ロケール情報はいろいろなカテゴリに分かれており、 それらはマクロとして宣言されている。 これらのマクロを \fBsetlocale\fP(3) 関数の最初の引き数に用いると、 これらのどれかを望むロケールに設定できる。 .TP \fBLC_ADDRESS\fP (GNU 拡張、 glibc 2.2 以降) .\" See ISO/IEC Technical Report 14652 Change settings that describe the formats (e.g., postal addresses) used to describe locations and geography\-related items. Applications that need this information can use \fBnl_langinfo\fP(3) to retrieve nonstandard elements, such as \fB_NL_ADDRESS_COUNTRY_NAME\fP (country name, in the language of the locale) and \fB_NL_ADDRESS_LANG_NAME\fP (language name, in the language of the locale), which return strings such as "Deutschland" and "Deutsch" (for German\-language locales). (Other element names are listed in \fI\fP.) .TP \fBLC_COLLATE\fP これは地域的なアルファベット文字列の比較に使用する \fBstrcoll\fP(3) 関数と \fBstrxfrm\fP(3) 関数の動作を変更する。例えばドイツ語のエスツェット (鋭い s) は、ソートの際 "ss" として扱われる。 .TP \fBLC_CTYPE\fP これは \fBisupper\fP(3) や \fBtoupper\fP(3) のような文字の判定・操作をする関数や、多バイト文字を扱う \fBmblen\fP(3) や \fBwctomb\fP(3) のような関数の動作を変更する。 .TP \fBLC_IDENTIFICATION\fP (GNU 拡張、 glibc 2.2 以降) .\" See ISO/IEC Technical Report 14652 Change settings that relate to the metadata for the locale. Applications that need this information can use \fBnl_langinfo\fP(3) to retrieve nonstandard elements, such as \fB_NL_IDENTIFICATION_TITLE\fP (title of this locale document) and \fB_NL_IDENTIFICATION_TERRITORY\fP (geographical territory to which this locale document applies), which might return strings such as "English locale for the USA" and "USA". (Other element names are listed in \fI\fP.) .TP \fBLC_MONETARY\fP \fBlocaleconv\fP(3) によって返される情報を変更する。 これには小数点や区切りコンマの位置など、 数字の表示方法に関する詳細が含まれている。この情報は \fBstrfmon\fP(3) 関数が内部で使用する。 .TP \fBLC_MESSAGES\fP メッセージ表示に使用する言語を変更する。 また肯定的・否定的な回答をどのように表示するかを変更する。 この情報を簡単に使用するために、 GNU C ライブラリには \fBgettext\fP(3), \fBngettext\fP(3), \fBrpmatch\fP(3) 関数が含まれている。 GNU gettext ファミリーに属する関数は、カテゴリが \fB"C"\fP 以外の有効なロケールに設定されている場合、環境変数 \fBLANGUAGE\fP にも従う (\fBLANGUAGE\fP はコロン区切りのロケールのリストである)。 .TP \fBLC_MEASUREMENT\fP (GNU 拡張、 glibc 2.2 以降) Change the settings relating to the measurement system in the locale (i.e., metric versus US customary units). Applications can use \fBnl_langinfo\fP(3) to retrieve the nonstandard \fB_NL_MEASUREMENT_MEASUREMENT\fP element, which returns a pointer to a character that has the value 1 (metric) or 2 (US customary units). .TP \fBLC_NAME\fP (GNU 拡張、 glibc 2.2 以降) .\" See ISO/IEC Technical Report 14652 Change settings that describe the formats used to address persons. Applications that need this information can use \fBnl_langinfo\fP(3) to retrieve nonstandard elements, such as \fB_NL_NAME_NAME_MR\fP (general salutation for men) and \fB_NL_NAME_NAME_MS\fP (general salutation for women) elements, which return strings such as "Herr" and "Frau" (for German\-language locales). (Other element names are listed in \fI\fP.) .TP \fBLC_NUMERIC\fP \fBprintf\fP(3) 関数および \fBscanf\fP(3) 関数のファミリーでロケール設定を使うよう指示された場合に 用いる情報を変更する。この情報は \fBlocaleconv\fP(3) 関数で取得することもできる。 .TP \fBLC_PAPER\fP (GNU extension, since glibc 2.2) .\" See ISO/IEC Technical Report 14652 Change the settings relating to the dimensions of the standard paper size (e.g., US letter versus A4). Applications that need the dimensions can obtain them by using \fBnl_langinfo\fP(3) to retrieve the nonstandard \fB_NL_PAPER_WIDTH\fP and \fB_NL_PAPER_HEIGHT\fP elements, which return \fIint\fP values specifying the dimensions in millimeters. .TP \fBLC_TELEPHONE\fP (GNU extension, since glibc 2.2) .\" See ISO/IEC Technical Report 14652 Change settings that describe the formats to be used with telephone services. Applications that need this information can use \fBnl_langinfo\fP(3) to retrieve nonstandard elements, such as \fB_NL_TELEPHONE_INT_PREFIX\fP (international prefix used to call numbers in this locale), which returns a string such as "49" (for Germany). (Other element names are listed in \fI\fP.) .TP \fBLC_TIME\fP \fBstrftime\fP(3) 関数の動作を変更し、 地域で利用されている方法で現在時刻を表示する。 例えば、ヨーロッパの多くでは 24時間式の時計を使うが、 アメリカでは 12時間式の時計を使う。 .TP \fBLC_ALL\fP 上記の全て。 .PP \fBsetlocale\fP(3) の二番目の引き数が空文字列 \fB""\fP の場合、 デフォルトのロケールは以下の手順で決定する: .IP 1. 環境変数 \fBLC_ALL\fP が設定されている場合には \fBLC_ALL\fP の値が使用される。 .IP 2. 上記のカテゴリのどれかと同じ名前の環境変数が設定されている場合には、 そのカテゴリにはその値が使用される。 .IP 3. 環境変数 \fBLANG\fP が設定されている場合には \fBLANG\fP の値が使用される。 .PP 地域的な数値フォーマットの情報は \fBlocaleconv\fP(3) 関数によって返される \fIstruct lconv\fP で得ることができ、これは以下のように宣言されている: .in +2n .nf struct lconv { /* (通貨以外の) 数値情報 */ char *decimal_point; /* 小数点の文字 */ char *thousands_sep; /* 小数点の左側の数字のグループの 区切り文字 */ char *grouping; /* それぞれの要素は各グループの数字の個数である。 インデックス値が大きいほど、左側のグループを表す。 要素の値が CHAR_MAX の場合は、最後のグループで あることを意味する。要素の値が 0 の場合は、 その要素より左側の全ての要素に前の要素と同じ値を 使用することを意味する。 */ /* 残りのフィールドは通貨情報用である */ char *int_curr_symbol; /* 最初の三つの文字は ISO 4217 の通貨記号。 四番目の文字は区切り文字。 五番目は \(aq\0\(aq。 */ char *currency_symbol; /* 地域の通貨記号 */ char *mon_decimal_point; /* 小数点の文字 */ char *mon_thousands_sep; /* 上記の `thousands_sep' と同様 */ char *mon_grouping; /* 上記の `grouping' と同様 */ char *positive_sign; /* 正の値の符号 */ char *negative_sign; /* 負の値の符号 */ char int_frac_digits; /* 国際的な小数部の数字 */ char frac_digits; /* 地域の小数部の数字 */ char p_cs_precedes; /* 正の値の前に通貨記号を置く場合は 1, 後ろに置く場合は 0 */ char p_sep_by_space; /* 正の値と通貨記号の間にスペースを 入れる場合は 1 */ char n_cs_precedes; /* 負の値の前に通貨記号を置く場合は 1, 後ろに置く場合は 0 */ char n_sep_by_space; /* 負の値と通貨記号の間にスペースを 入れる場合は 1 */ /* 正と負の符号の位置: 0 値と通貨記号を括弧で囲む 1 符号は値と通貨記号の前に置く 2 符号は値と通貨記号の後に置く 3 符号は通貨記号の直後に置く 4 符号は通貨記号の直前に置く */ char p_sign_posn; char n_sign_posn; }; .fi .in .SS "POSIX.1\-2008 extensions to the locale API" POSIX.1\-2008 standardized a number of extensions to the locale API, based on implementations that first appeared in version 2.3 of the GNU C library. 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. The extensions take the form of new functions for creating and manipulating locale objects (\fBnewlocale\fP(3), \fBfreelocale\fP(3), \fBduplocale\fP(3), and \fBuselocale\fP(3)) and various new library functions with the suffix "_l" (e.g., \fBtoupper_l\fP(3)) that extend the traditional locale\-dependent APIs (e.g., \fBtoupper\fP(3)) to allow the specification of a locale object that should apply when executing the function. .SH 準拠 .\" .\" The GNU gettext functions are specified in LI18NUX2000. POSIX.1\-2001. .SH 関連項目 \fBlocale\fP(1), \fBlocaledef\fP(1), \fBcatopen\fP(3), \fBgettext\fP(3), \fBlocaleconv\fP(3), \fBmbstowcs\fP(3), \fBnewlocale\fP(3), \fBngettext\fP(3), \fBnl_langinfo\fP(3), \fBrpmatch\fP(3), \fBsetlocale\fP(3), \fBstrcoll\fP(3), \fBstrfmon\fP(3), \fBstrftime\fP(3), \fBstrxfrm\fP(3), \fBuselocale\fP(3), \fBwcstombs\fP(3), \fBlocale\fP(5) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.65 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。