Scroll to navigation

LOCALE(5) Linux User Manual LOCALE(5)

名前

locale - ロケール定義ファイル

説明

ロケール (locale) 定義ファイルは localedef(1) コマンドがバイナリのロケールデータベースに変換するのに 必要な全ての情報を含んでいる。

The definition files consist of sections which each describe a locale category in detail. See locale(7) for additional details for these categories.

文法

ロケール定義ファイルは以下のキーワードから構成されるヘッダーで始まる:

ファイルの残りの部分でエスケープキャラクターとして使用する文字を 指定する。これは特殊な意味に解釈される文字をエスケープするのに使用する。 デフォルトはバックスラッシュ (\) である。
ファイルの残りの部分でコメントキャラクターとして使用する文字 を指定する。デフォルトではシャープ (#) である。

The locale definition has one part for each locale category. Each part can be copied from another existing locale or can be defined from scratch. If the category should be copied, the only valid keyword in the definition is copy followed by the name of the locale in double quotes which should be copied. The exceptions for this rule are LC_COLLATE and LC_CTYPE where a copy statement can be followed by locale-specific rules and selected overrides.

When defining a locale or a category from scratch, an existing system- provided locale definition file should be used as a reference to follow common glibc conventions.

ロケールカテゴリー

以下のカテゴリーが POSIX で定義されている。

  • LC_CTYPE
  • LC_COLLATE
  • LC_MESSAGES
  • LC_MONETARY
  • LC_NUMERIC
  • LC_TIME

また、バージョン 2.2 以降の GNU C ライブラリでは以下の非標準のカテゴリーにも対応している。

  • LC_ADDRESS
  • LC_IDENTIFICATION
  • LC_MEASUREMENT
  • LC_NAME
  • LC_PAPER
  • LC_TELEPHONE

各カテゴリーの詳細な説明は locale(7) を参照。

LC_ADDRESS

このカテゴリーの定義は最初のカラムに LC_ADDRESS という文字列を置くことで始める。

ここでは以下のキーワードが使用できる:

このロケールでの郵便の住所に使用するフォーマットを定義するフィールド記述子が入った文字列を指定する。 以下のフィールド指定子を使用できる。
%n
Person's name, possibly constructed with the LC_NAME name_fmt keyword (since glibc 2.24).
%a
気付、組織
%f
社名
%d
部署名
%b
ビル名
%s
通り、ブロック名
%h
番地
%N
直前の記述子の値が空でない場合 end-of-line を挿入する。 そうでない場合は無視される。
%t
直前の記述子の値が空でない場合、 スペースを挿入する。 そうでない場合は無視される。
%r
部屋番号
%e
フロア番号
%C
国、 country_post キーワードから指定する
%l
Local township within town or city (since glibc 2.24).
%z
郵便番号
%T
町、市
%S
州、省、県
%c
国。 データレコードから取得される。

各フィールドでは '%' の後ろに 'R' を置いて、 その要素のローマ字版の文字列を使用するように指定することができる。

そのドキュメントの言語での国名を指定する (例えば、 de_DE ロケールでは "Deutschland")
国の省略名を指定する (CERT_MAILCODES 参照)
国の 2 文字の省略形を指定する (ISO 3166)
国の 3 文字の省略形を指定する (ISO 3166)
数字の国コードを指定する (ISO 3166)
followed by the international license plate country code.
(書籍用の) ISBN コードを指定する
そのドキュメントの言語での言語名を指定する
言語の 2 文字の省略形を指定する (ISO 639)
言語の 3 文字の省略形を指定する (ISO 639-2/T)
ライブラリで使用する言語の 3 文字の省略形を指定する (ISO 639-2/B)。 一般には、アプリケーションは lang_lib よりも lang_term を優先すべきである。

LC_ADDRESS の定義は END LC_ADDRESS という文字列で終了する。

LC_CTYPE

このカテゴリーの定義は最初のカラムに LC_CTYPE という文字列を置くことで始める。

ここでは以下のキーワードが使用できる:

大文字 (uppercase letter) のリストを指定する。 A から Z までの文字は自動的に含まれる。 cntrl, digit, punct, space に指定された文字を指定することはできない。
小文字 (lowercase letter) のリストを指定する。 a から z までの文字は自動的に含まれる。 cntrl, digit, punct, space に指定された文字を指定することはできない。
アルファベットの文字を指定する。 upperlower を指定した全ての文字は自動的に含まれる。 cntrl, digit, punct, space に指定された文字を指定することはできない。
数字として使用される文字を指定する。数字としては 0 から 9 のみが使用できる。これらはデフォルトで含まれている。
空白として使用する文字のリストを指定する。 upper, lower, alpha, digit, graph, xdigit に指定された文字を指定することはできない。 <space>, <form-feed>, <newline>, <carriage-return>, <tab>, <vertical-tab> は自動的に含まれる。
コントロールキャラクターのリストを指定する。 upper, lower, alpha, digit, punct, graph, print, xdigit に指定された文字を指定することはできない。
句読点文字のリストを指定する。 upper, lower, alpha, digit, cntrl, xdigit, <space> に指定された文字を指定することはできない。
表示可能文字のリストを指定するが、 <space> 文字は含まない。 upper, lower, alpha, digit, xdigit, punct を指定した文字は自動的に含まれる。 cntrl に指定された文字を指定することはできない。
<space> 文字を含めた表示可能文字のリストを指定する。 upper, lower, alpha, digit, xdigit, punct, <space> に指定した文字は自動的に含まれる。 cntrl に指定された文字を指定することはできない。
16 進数として使用する文字のリストを指定する。10 進の数字に加えて、 6 文字を昇順で続ける。デフォルトでは以下の文字が含まれている: 0 から 9a から fA から F
無地 (blank) に分類される文字のリストを指定する。 <space><tab> は自動的に含まれる。
followed by a list of locale-specific character class names which are then to be defined in the locale.
小文字から大文字への対応リストを指定する。各対応は小文字と大文字のペアを , で区切って括弧で括って指定する。
大文字から小文字への対応リストを指定する。tolower という キーワードが無い場合には toupper を逆にしたものが使用される。
followed by a list of mapping pairs of characters and letters to be used in titles (headings).
followed by a locale-specific character class definition, starting with the class name followed by the characters belonging to the class.
followed by a list of locale-specific character mapping names which are then to be defined in the locale.
followed by a list of alternate output digits for the locale.
followed by a list of mapping pairs of alternate digits and separators for input digits for the locale.
followed by a list of mapping pairs of alternate separators for output for the locale.
marks the start of the transliteration rules section. The section can contain the include keyword in the beginning followed by locale-specific rules and overrides. Any rule specified in the locale file will override any rule copied or included from other files. In case of duplicate rule definitions in the locale file, only the first rule is used.
A transliteration rule consist of a character to be transliterated followed by a list of transliteration targets separated by semicolons. The first target which can be presented in the target character set is used, if none of them can be used the default_missing character will be used instead.
in the transliteration rules section includes a transliteration rule file (and optionally a repertoire map file).
in the transliteration rules section defines the default character to be used for transliteration where none of the targets cannot be presented in the target character set.
marks the end of the transliteration rules.

LC_CTYPE の定義は END LC_CTYPE という文字列で終了する。

LC_COLLATE

Note that glibc does not support all POSIX-defined options, only the options described below are supported (as of glibc 2.23).

このカテゴリーの定義は最初のカラムに LC_COLLATE を置くことで始める。

ここでは以下のキーワードが使用できる:

followed by the number representing used collation levels. This keyword is recognized but ignored by glibc.
複数文字からなる照合要素を表す照合要素シンボル (collating-element symbol) の定義を指定する。
照合順序定義 (order_start) で使用できる照合シンボル (collating symbol) の定義を指定する。
followed by string to be evaluated in an ifdef string / else / endif construct.
followed by a redefinition of a collation rule.
marks the end of the redefinition of a collation rule.
followed by a script name to reorder listed scripts after.
marks the end of the reordering of sections.
followed by a declaration of a script.
followed by a collating-symbol to be equivalent to another defined collating-symbol.

The collation rule definition starts with a line:

followed by a list of keywords chosen from forward, backward, or position. The order definition consists of lines that describe the collation order and is terminated with the keyword order_end.

LC_COLLATE 定義は END LC_COLLATE という文字列で終了する。

LC_IDENTIFICATION

このカテゴリーの定義は最初のカラムに LC_IDENTIFICATION という文字列を置くことで始める。

ここでは以下のキーワードが使用できる:

このロケール文書のタイトル (例えば "Maori language locale for New Zealand" (「ニュージーランドのマオリ語のロケール」))。
この文書を管理している組織名。
この文書を管理している組織の住所。
この文書を管理している組織の担当者の名前。
この文書を管理している組織の担当者の電子メールアドレス。
followed by the telephone number (in international format) of the organization that maintains this document. As of glibc 2.24, this keyword is deprecated in favor of other contact methods.
followed by the fax number (in international format) of the organization that maintains this document. As of glibc 2.24, this keyword is deprecated in favor of other contact methods.
この文書が適用される言語名。
この文書が適用される国や地理的範囲の名前。
この文書が想定する対象者の説明。
この文書が想定する特別な適用先を記載する。
followed by the short name for provider of the source of this document.
この文書の版数。
この文書のこの版の日付。

さらに、 この文書で定義されるカテゴリー毎に、キーワード category で始まり以下の内容が続く行を用意する必要がある。

  • このロケールカテゴリー定義を識別する文字列
  • セミコロン
  • LC_* 識別子のいずれか 1 つ

LC_IDENTIFICATION の定義は END LC_IDENTIFICATION という文字列で終了する。

LC_MESSAGES

このカテゴリーの定義は最初のカラムに LC_MESSAGES という文字列を置くことで始める。

ここでは以下のキーワードが使用できる:

「はい (yes)」を意味する正規表現を指定する。
「いいえ (no)」を意味する正規表現を指定する。
"yes" に対応する出力文字列を指定する。
"no" に対応する出力文字列を指定する。

LC_MESSAGES の定義は END LC_MESSAGES という文字列で終了する。

LC_MEASUREMENT

このカテゴリーの定義は最初のカラムに LC_MEASUREMENT という文字列を置くことで始める。

ここでは以下のキーワードが使用できる:

単位系として使用される標準を指定する数値。 以下の値が使用できる。
1
メートル法
2
US で使用される単位系

LC_MEASUREMENT の定義は END LC_MEASUREMENT という文字列で終了する。

LC_MONETARY

このカテゴリーの定義は最初のカラムに LC_MONETARY という文字列を置くことで始める。

ここでは以下のキーワードが使用できる:

国際通貨記号を指定する。これは ISO 4217 規格に定義された国際通貨 記号 (3 文字) に区切り文字を続けた 4 文字である必要がある。
地域的な通貨記号を指定する。
followed by the single-character string that will be used as the decimal delimiter when formatting monetary quantities.
followed by the single-character string that will be used as a group separator when formatting monetary quantities.
金額の表示方法を規定する整数の列。 セミコロン区切りの通常の数字。 詳細は下記の grouping を参照。
数値において正の符号に使用する文字列を指定する。
数値において負の符号に使用する文字列を指定する。
int_curr_symbol でフォーマットする時に使用すべき端数の桁数を指定する。
currency_symbol でフォーマットする際に使用すべき端数の桁数を指定する。
負でない金額を表示する際に currency_symbol を置く位置を示す数字を指定する。
0
記号は数値の後におく。
1
記号は数値の前におく。
負でない金額を表示する際に、 currency_symbol、 符号記号、 値の区切り方を示す数値を指定する。 以下の値が使用できる。
0
通貨記号と値の間にスペースを入れない。
1
通貨記号と符号記号が隣り合う場合、 値との間にスペースを入れる。 そうでない場合、通貨記号と値の間スペースを置く。
2
通貨記号と符号記号が隣り合う場合、 値との間にスペースを入れる。 そうでない場合、符号記号と値はそれぞれスペースで区切られる。
負の金額を表示する際に currency_symbol を置く位置を示す数字を指定する。 指定できる値は p_cs_precedes と同じである。
負の金額を表示する際に、 currency_symbol、 符号記号、 値の区切り方を示す数値を指定する。 指定できる値は p_sep_by_space である。
負でない金額の場合に positive_sign を置く必要があるかを示す整数を指定する。
0
値と currency_symbol または int_curr_symbol を括弧で括る。
1
符号を値と currency_symbol または int_curr_symbol の前に置く。
2
符号を値と currency_symbol または int_curr_symbol の後に置く。
3
符号を currency_symbol または int_curr_symbol の前に置く。
4
符号を currency_symbol または int_curr_symbol の後に置く。
負の金額の場合に negative_sign を置く必要があるかを示す整数を指定する。 指定できる値は p_sign_posn と同じである。
負でない金額を国際的なフォーマットで表示する際に int_curr_symbol を置く位置を示す数字を指定する。 指定できる値は p_cs_precedes と同じである。
負の金額を国際的なフォーマットで表示する際に int_curr_symbol を置く位置を示す数字を指定する。 指定できる値は p_cs_precedes と同じである。
負でない金額を国際的なフォーマットで表示する際に、 int_curr_symbol、 符号記号、 値の区切り方を示す数値を指定する。 指定できる値は p_sep_by_space である。
負の金額を国際的なフォーマットで表示する際に、 int_curr_symbol、 符号記号、 値の区切り方を示す数値を指定する。 指定できる値は p_sep_by_space である。
負でない金額を国際的なフォーマットで表示する際に positive_sign を置く必要があるかを示す整数を指定する。 指定できる値は p_sign_posn と同じである。
負の金額を国際的なフォーマットで表示する際に negative_sign を置く必要があるかを示す整数を指定する。 指定できる値は p_sign_posn と同じである。

LC_MONETARY の定義は END LC_MONETARY という文字列で終了する。

LC_NAME

このカテゴリーの定義は最初のカラムに LC_NAME という文字列を置くことで始める。

様々なキーワードを指定できるが、 必須なのは name_fmt だけである。 それ以外のキーワードは、 このロケールで、 対応するあいさつを使う慣習が普及している場合にのみ指定が必要である。 指定できるキーワードは以下のとおりである。

このロケールで名前に対して使用する表示方法を定義するフィールド記述子が入った文字列を指定する。 以下のフィールド記述子を使用できる。
%f
姓 (family name)
%F
大文字の姓 (family name)
%g
名 (first given name)
%G
名の頭文字
%l
ラテン文字での名 (first given name)
%o
他の短い名前
%m
追加の名前 (given name)
%M
追加の名前の頭文字
%p
職業
%s
呼びかけの言葉 (例えば「Doctor」など)
%S
省略形の呼びかけの言葉 ("Mr." や "Dr.")
%d
FDCC (Formal Definitions of Cultural Convention) 集合で使用される呼びかけの言葉
%t
直前のフィールド記述子が空文字列になった場合、 空文字列となる。 それ以外の場合、 スペース文字となる。
男性・女性を問わず使える一般的な呼びかけの言葉
男性に対する呼びかけの言葉
既婚女性に対する呼びかけの言葉
未婚女性に対する呼びかけの言葉
どの女性にも使用できる呼びかけの言葉

LC_NAME の定義は END LC_NAME という文字列で終了する。

LC_NUMERIC

このカテゴリーの定義は最初のカラムに LC_NUMERIC という文字列を置くことで始める。

ここでは以下のキーワードが使用できる:

followed by the single-character string that will be used as the decimal delimiter when formatting numeric quantities.
followed by the single-character string that will be used as a group separator when formatting numeric quantities.
数値の表示方法を規定する整数の列。 セミコロン区切りの数字。
各数字はグループ内の数字の桁数を指定する。 最初の整数は小数点のすぐ左側のグループのサイズを規定する。 それ以降の数字は一つ前のグループの左側のグループのサイズを順に規定する。 最後の数字が -1 でない場合、 (グループがある場合) 直前のグループのサイズがそれ以降の桁についても使用される。 最後の整数が -1 の場合、 それ以降はグループ化を行わない。

The LC_NUMERIC の定義は END LC_NUMERIC という文字列で終了する。

LC_PAPER

このカテゴリーの定義は最初のカラムに LC_PAPER という文字列を置くことで始める。

ここでは以下のキーワードが使用できる:

標準の紙のサイズの高さをミリメートル単位で指定する。
標準の紙のサイズの幅をミリメートル単位で指定する。

LC_PAPER の定義は END LC_PAPER という文字列で終了する。

LC_TELEPHONE

このカテゴリーの定義は最初のカラムに LC_TELEPHONE という文字列を置くことで始める。

ここでは以下のキーワードが使用できる:

国際番号に電話をかける場合に使用するフォーマットを示すフィールド記述子を含む文字列を指定する。 以下のフィールド記述子を使用できる。
%a
全国で一意なプレフィックスを含まないエリアコード (多くの場合、プレフィックスは "00")。
%A
全国で一意なプレフィックスを含んだエリアコード。
%l
(エリア内の) 市内局番。
%e
(市内局番に対する) 内線番号。
%c
国番号。
%C
海外通話の際に使用される代わりのキャリアーサービスコード。
%t
直前のフィールド記述子が空文字列になった場合、 空文字列となる。 それ以外の場合、 スペース文字となる。
国内番号に電話をかける場合に使用するフォーマットを示すフィールド記述子を含む文字列を指定する。 使用できるフィールド記述子は tel_int_fmt と同じである。
国際電話番号に電話をかける際に使用するプレフィックスを指定する。
他の国からこの国に電話をかける際に使用するプレフィックスを指定する。

LC_TELEPHONE の定義は END LC_TELEPHONE という文字列で終了する。

LC_TIME

このカテゴリーの定義は最初のカラムに LC_TIME という文字列を置くことで始める。

ここでは以下のキーワードが使用できる:

曜日の名前の省略形のリストを指定する。 リストは week で指定された週の開始曜日 (デフォルトでは日曜日) から始める。 「注意」を参照。
曜日の名前のリストを指定する。 リストは week で指定された週の開始曜日 (デフォルトでは日曜日) から始める。 「注意」を参照。
月の名前の省略形のリストを指定する。
月の名前のリストを指定する。
適切な日付け (date) と時刻 (time) のフォーマットを指定する (書式については strftime(3) を参照)。
followed by the appropriate date format (for syntax, see strftime(3)).
適切な時刻のフォーマットを指定する (書式については strftime(3) を参照)。
それぞれ 午前 (am)午後 (pm) に対応する文字列を指定する。 AM/PM を使う慣習がないロケールでは、このフィールドは空にすべきである。
12 時間時計を使う際に使用する時刻形式を指定する (書式については strftime(3) を参照)。 午前/午後の表記を使用しないロケールではこのフィールドは空にすること。
followed by semicolon-separated strings that define how years are counted and displayed for each era in the locale. Each string has the following format:

direction:offset:start_date:end_date:era_name:era_format

The fields are to be defined as follows:

Either + or -. + means the years closer to start_date have lower numbers than years closer to end_date. - means the opposite.
The number of the year closest to start_date in the era, corresponding to the %Ey descriptor (see strptime(3)).
The start of the era in the form of yyyy/mm/dd. Years prior AD 1 are represented as negative numbers.
The end of the era in the form of yyyy/mm/dd, or one of the two special values of -* or +*. -* means the ending date is the beginning of time. +* means the ending date is the end of time.
The name of the era corresponding to the %EC descriptor (see strptime(3)).
The format of the year in the era corresponding to the %EY descriptor (see strptime(3)).
followed by the format of the date in alternative era notation, corresponding to the %Ex descriptor (see strptime(3)).
followed by the format of the time in alternative era notation, corresponding to the %EX descriptor (see strptime(3)).
followed by the format of the date and time in alternative era notation, corresponding to the %Ec descriptor (see strptime(3)).
followed by the alternative digits used for date and time in the locale.
セミコロン区切りの 3 つの値からなるリストを指定する。 リストは、一週間の日数 (デフォルトでは 7)、 週の開始曜日 (デフォルトでは日曜に対応)、 一年の最初の週の最小の長さ (デフォルトでは 4) から構成される。 週の開始曜日については、週の開始日が日曜日の場合には 19971130 を、月曜日の場合には 19971201 を使用する。 「注意」を参照。
followed by the number of the day from the day list to be shown as the first day of the week in calendar applications. The default value of 1 corresponds to either Sunday or Monday depending on the value of the second week list item. See NOTES.
followed by the number of the first working day from the day list. The default value is 2. See NOTES.
followed by a number value that indicates the direction for the display of calendar dates, as follows:
1
左から右を、上から順に。
2
上から下を、左から順に。
3
右から左を、上から順に。
date(1) に適した日付の表現を指定する (書式については strftime(3) を参照)。

LC_TIME の定義は END LC_TIME という文字列で終了する。

ファイル

/usr/lib/locale/locale-archive
通常のデフォルトのロケールアーカイブファイル
/usr/share/i18n/locales
ロケール定義ファイルの通常のデフォルトパス

準拠

POSIX.2.

注意

abday, day, week, first_weekday, first_workday に関する GNU C ライブラリコミュニティーで培ったノウハウについて https://sourceware.org/glibc/wiki/Locales で以下のように書かれている。

  • week リストの 2 番目の項目の値は abdayday のリストの起点となる日を指定する。
  • first_weekdayabdayday のリストの中で最初に表示する週の曜日 (オフセット) を指定する。
  • For compatibility reasons, all glibc locales should set the value of the second week list item to 19971130 (Sunday) and base the abday and day lists appropriately, and set first_weekday and first_workday to 1 or 2, depending on whether the week and work week actually starts on Sunday or Monday for the locale.

関連項目

iconv(1), locale(1), localedef(1), localeconv(3), newlocale(3), setlocale(3), strftime(3), strptime(3), uselocale(3), charmap(5), charsets(7), locale(7), unicode(7), utf-8(7)

この文書について

この man ページは Linux man-pages プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は https://www.kernel.org/doc/man-pages/ に書かれている。

2020-11-01 Linux