.\" 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 .\" .\"******************************************************************* .\" .\" 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\-12\-31 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 場所や地理関連の項目の表示に使用するフォーマット (郵便番号など) に関する設定を変更する。 この情報が必要なアプリケーションは \fBnl_langinfo\fP(3) を使って非標準の要素を取得できる。 \fB_NL_ADDRESS_COUNTRY_NAME\fP (指定されたロケールの言語での国名) や \fB_NL_ADDRESS_LANG_NAME\fP (指定されたロケールの言語での言語名) などがあり、 ドイツ語ロケールでは "Deutschland" と "Deutsch" といった文字列が返される。 他の要素名については \fI\fP にリストがある。 .TP \fBLC_COLLATE\fP This category governs the collation rules used for sorting and regular expressions, including character equivalence classes and multicharacter collating elements. This locale category changes the behavior of the functions \fBstrcoll\fP(3) and \fBstrxfrm\fP(3), which are used to compare strings in the local alphabet. For example, the German sharp s is sorted as "ss". .TP \fBLC_CTYPE\fP This category determines the interpretation of byte sequences as characters (e.g., single versus multibyte characters), character classifications (e.g., alphabetic or digit), and the behavior of character classes. It changes the behavior of the character handling and classification functions, such as \fBisupper\fP(3) and \fBtoupper\fP(3), and the multibyte character functions such as \fBmblen\fP(3) or \fBwctomb\fP(3). .TP \fBLC_IDENTIFICATION\fP (GNU 拡張、 glibc 2.2 以降) .\" See ISO/IEC Technical Report 14652 ロケールのメタデータに関連する設定を変更する。 この情報が必要なアプリケーションは \fBnl_langinfo\fP(3) を使って非標準の要素を取得できる。 \fB_NL_IDENTIFICATION_TITLE\fP (このロケール文書のタイトル) や \fB_NL_IDENTIFICATION_TERRITORY\fP (このロケール文書が適用される地理的な範囲) などがあり、 "English locale for the USA" や "USA" といった文字列が返される。 他の要素名については \fI\fP にリストがある。 .TP \fBLC_MONETARY\fP This category determines the formatting used for monetary\-related numeric values. This changes the information returned by \fBlocaleconv\fP(3), which describes the way numbers are usually printed, with details such as decimal point versus decimal comma. This information is internally used by the function \fBstrfmon\fP(3). .TP \fBLC_MESSAGES\fP This category affects the language in which messages are displayed and what an affirmative or negative answer looks like. The GNU C library contains the \fBgettext\fP(3), \fBngettext\fP(3), and \fBrpmatch\fP(3) functions to ease the use of this information. The GNU gettext family of functions also obey the environment variable \fBLANGUAGE\fP (containing a colon\-separated list of locales) if the category is set to a valid locale other than \fB"C"\fP. This category also affects the behavior of \fBcatopen\fP(3). .TP \fBLC_MEASUREMENT\fP (GNU 拡張、 glibc 2.2 以降) ロケールの測定系 (つまり、メートル法かアメリカでよく使われる単位か) に関連する設定を変更する。 この情報が必要なアプリケーションは \fBnl_langinfo\fP(3) を使って非標準の要素である \fB_NL_MEASUREMENT_MEASUREMENT\fP を取得できる。 この要素は 1 (メートル法) か 2 (アメリカでよく使われる単位) の値が入った文字列へのポインタを返す。 .TP \fBLC_NAME\fP (GNU 拡張、 glibc 2.2 以降) .\" See ISO/IEC Technical Report 14652 人に呼びかける際に使用されるフォーマットに関する設定を変更する。 この情報が必要なアプリケーションは \fBnl_langinfo\fP(3) を使って非標準の要素を取得できる。 \fB_NL_NAME_NAME_MR\fP (男性に対する一般的な呼び掛け) や \fB_NL_NAME_NAME_MS\fP (女性に対する一般的な呼び掛け) などがあり、 ドイツ語ロケールでは "Herr" や "Frau" といった文字列が返される。 他の要素名については \fI\fP にリストがある。 .TP \fBLC_NUMERIC\fP This category determines the formatting rules used for nonmonetary numeric values\(emfor example, the thousands separator and the radix character (a period in most English\-speaking countries, but a comma in many other regions). It affects functions such as \fBprintf\fP(3), \fBscanf\fP(3), and \fBstrtod\fP(3). This information can also be read with the \fBlocaleconv\fP(3) function. .TP \fBLC_PAPER\fP (GNU 拡張、 glibc 2.2 以降) .\" See ISO/IEC Technical Report 14652 標準的な紙のサイズの寸法 (US letter や A4 など) に関する設定を変更する。 この情報が必要なアプリケーションは \fBnl_langinfo\fP(3) を使って非標準の要素である \fB_NL_PAPER_WIDTH\fP と \fB_NL_PAPER_HEIGHT\fP を取得できる。 この要素はミリメーター単位の寸法を指定する \fIint\fP 値を返す。 .TP \fBLC_TELEPHONE\fP (GNU 拡張、 glibc 2.2 以降) .\" See ISO/IEC Technical Report 14652 電話サービスで使用されるフォーマットに関する設定を変更する。 この情報が必要なアプリケーションは \fBnl_langinfo\fP(3) を使って非標準の要素を取得できる。 \fB_NL_TELEPHONE_INT_PREFIX\fP (そのロケールでの電話番号の前に付く国を示す番号) などがある。 "49" (ドイツの場合) といった文字列が返される。 他の要素名については \fI\fP にリストがある。 .TP \fBLC_TIME\fP This category governs the formatting used for date and time values. For example, most of Europe uses a 24\-hour clock versus the 12\-hour clock used in the United States. The setting of this category affects the behavior of functions such as \fBstrftime\fP(3) and \fBstrptime\fP(3). .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 "ロケール API の POSIX.1\-2008 での拡張" POSIX.1\-2008 では、 ロケール API への多くの拡張が標準化されている。 これは GNU C ライブラリのバージョン 2.3 で初めて登場した実装に基づいている。 これらの拡張は、 従来のロケール API がマルチスレッドアプリケーションや複数のロケールを扱う必要があるアプリケーションとうまく組み合わせて使うことができない問題を解決するために設計された。 この拡張は、 ロケールオブジェクトの作成、操作のための新しい関数 (\fBnewlocale\fP(3), \fBfreelocale\fP(3), \fBduplocale\fP(3), \fBuselocale\fP(3)) とサフィックス "_l" が付いた新しいライブラリ関数 (\fBtoupper_l\fP(3) など) で構成される。 新しいライブラリ関数は、 従来のロケール依存の API (\fBtoupper\fP(3) など) を関数実行時に適用するロケールオブジェクトの指定ができるように拡張したものである。 .SH 環境変数 The following environment variable is used by \fBnewlocale\fP(3) and \fBsetlocale\fP(3), and thus affects all unprivileged localized programs: .TP \fBLOCPATH\fP A list of pathnames, separated by colons (\(aq:\(aq), that should be used to find locale data. If this variable is set, only the individual compiled locale data files from \fILOCPATH\fP and the system default locale data path are used; any available locale archives are not used (see \fBlocaledef\fP(1)). The individual compiled locale data files are searched for under subdirectories which depend on the currently used locale. For example, when \fIen_GB.UTF\-8\fP is used for a category, the following subdirectories are searched for, in this order: \fIen_GB.UTF\-8\fP, \fIen_GB.utf8\fP, \fIen_GB\fP, \fIen.UTF\-8\fP, \fIen.utf8\fP, and \fIen\fP. .SH ファイル .TP \fI/usr/lib/locale/locale\-archive\fP Usual default locale archive location. .TP \fI/usr/lib/locale\fP Usual default path for compiled individual locale files. .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), \fBcharsets\fP(7), \fBunicode\fP(7), \fButf\-8\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.76 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。