argra****@users*****
argra****@users*****
2018年 7月 19日 (木) 19:05:43 JST
Index: docs/perl/5.20.1/perllocale.pod diff -u docs/perl/5.20.1/perllocale.pod:1.4 docs/perl/5.20.1/perllocale.pod:1.5 --- docs/perl/5.20.1/perllocale.pod:1.4 Mon Sep 18 02:33:10 2017 +++ docs/perl/5.20.1/perllocale.pod Thu Jul 19 19:05:43 2018 @@ -82,16 +82,15 @@ 残念ながら、ロケールにはかなりの数の設計上の(そしてしばしば実装上の)欠陥が あります。 -Unicode was invented (see -L<perlunitut> for an introduction to that) in part to address these -design deficiencies, and nowadays, there is a series of "UTF-8 -locales", based on Unicode. +Unicode (これに関する紹介については +L<perlunitut> を参照してください) は、この設計上の欠陥に部分的に対処するために +発明され、そして最近では、Unicode を基とした +一連の 「UTF-8 ロケール」があります。 これらは文字集合は Unicode で、UTF-8 でエンコードされています。 v5.20 から、Perl は UTF-8 ロケールに完全に対応しています; ただしソートと 文字列比較を除きます。 (これらのためには L<Unicode::Collate> を使ってください。) Perl 古い非 UTF-8 ロケールも対応し続けています。 -(TBT) =begin original @@ -517,11 +516,9 @@ =end original -The current locale is also used when going outside of Perl with -operations like L<system()|perlfunc/system LIST> or -L<qxE<sol>E<sol>|perlop/qxE<sol>STRINGE<sol>>, if those operations are -locale-sensitive. -(TBT) +現在のロケールは、L<system()|perlfunc/system LIST> や +L<qxE<sol>E<sol>|perlop/qxE<sol>STRINGE<sol>> のような操作によって Perl の +外側に行く場合(その操作がロケールを認識する場合)にも使われます。 =item * @@ -538,15 +535,15 @@ =end original -Also Perl gives access to various C library functions through the -L<POSIX> module. Some of those functions are always affected by the -current locale. For example, C<POSIX::strftime()> uses C<LC_TIME>; -C<POSIX::strtod()> uses C<LC_NUMERIC>; C<POSIX::strcoll()> and -C<POSIX::strxfrm()> use C<LC_COLLATE>; and character classification -functions like C<POSIX::isalnum()> use C<LC_CTYPE>. All such functions -will behave according to the current underlying locale, even if that -locale isn't exposed to Perl space. -(TBT) +また、Perl は L<POSIX> モジュールを通して様々な C ライブラリ関数への +アクセスを提供します。 +これらの関数の一部は常に現在のロケールの影響を受けます。 +例えば、C<POSIX::strftime()> は C<LC_TIME> を使います; +C<POSIX::strtod()> は C<LC_NUMERIC> を使います; +C<POSIX::strcoll()> と C<POSIX::strxfrm()> は C<LC_COLLATE> を使います; +C<POSIX::isalnum()> のような文字分類関数は C<LC_CTYPE> を使います。 +これら全ての関数は、例えロケールが Perl 空間に露出していなくても、 +現在の基となるロケールに従って振る舞います。 =item * @@ -558,10 +555,9 @@ =end original -XS modules for all categories but C<LC_NUMERIC> get the underlying -locale, and hence any C library functions they call will use that -underlying locale. For more discussion, see L<perlxs/CAVEATS>. -(TBT) +C<LC_NUMERIC> 以外の全てのカテゴリに関する XS モジュールは基となる +ロケールを使うので、呼び出した C ライブラリ関数は基となるロケールを使います。 +さらなる議論については L<perlxs/CAVEATS> を参照してください。 =back @@ -586,10 +582,9 @@ =end original -Certain Perl operations that are set-up within the scope of a -C<use locale> variant retain that effect even outside the scope. -These include: -(TBT) +C<use locale> 系のスコープ内で設定される一部の Perl 操作は、 +スコープの外側でも影響を受けたままになります。 +これには以下のようなものがあります: =over 4 @@ -605,12 +600,10 @@ =end original -The output format of a L<write()|perlfunc/write> is determined by an -earlier format declaration (L<perlfunc/format>), so whether or not the -output is affected by locale is determined by if the C<format()> is -within the scope of a C<use locale> variant, not whether the C<write()> -is. -(TBT) +L<write()|perlfunc/write> の出力形式は、事前のフォーマット宣言 +(L<perlfunc/format>) によって決定されるので、出力がロケールの影響を +受けるかどうかは、C<format()> は C<use locale> 系のスコープ内にあるかどうかで +決定され、C<write()> ではありません。 =item * @@ -624,12 +617,12 @@ =end original -Regular expression patterns can be compiled using -L<qrE<sol>E<sol>|perlop/qrE<sol>STRINGE<sol>msixpodual> with actual -matching deferred to later. Again, it is whether or not the compilation -was done within the scope of C<use locale> that determines the match -behavior, not if the matches are done within such a scope or not. -(TBT) +正規表現パターンは、 +L<qrE<sol>E<sol>|perlop/qrE<sol>STRINGE<sol>msixpodual> を使って、 +実際のマッチングを後に遅らせてコンパイルすることが出来ます。 +再び、コンパイルが C<use locale> のスコープ内で行われたかどうかが +マッチングの振る舞いを決定します; スコープ内でマッチングが +行われたかどうかではありません。 =back @@ -1158,11 +1151,10 @@ =end original -その他の多くのテストに加えて、システムで発見された全てのロケールについてit will test every locale it finds on your -system to see if they conform to the POSIX standard. +その他の多くのテストに加えて、システムで発見された全てのロケールについて +POSIX 標準に従っているかどうかをテストします。 エラーがあった場合、どのロケールが全てのテストに成功したかの出力の末尾辺りに、 どのテストがなぜ失敗したかの概要が含まれます。 -(TBT) =head2 Temporarily fixing locale problems @@ -1884,20 +1876,23 @@ =end original v5.20 から、Perl は C<LC_CTYPE> に関して C<LC_CTYPE> に対応していますが、 -それ以外では Perl only supports single-byte locales, such as the ISO 8859 -series. This means that wide character locales, for example for Asian -languages, are not supported. The UTF-8 locale support is actually a -superset of POSIX locales, because it is really full Unicode behavior -as if no locale were in effect at all (except for tainting; see -L</SECURITY>). POSIX locales, even UTF-8 ones, -are lacking certain concepts in Unicode, such as the idea that changing -the case of a character could expand to be more than one character. -Perl in a UTF-8 locale, will give you that expansion. Prior to v5.20, -Perl treated a UTF-8 locale on some platforms like an ISO 8859-1 one, -with some restrictions, and on other platforms more like the "C" locale. -For releases v5.16 and v5.18, C<S<use locale 'not_characters>> could be -used as a workaround for this (see L</Unicode and UTF-8>). -(TBT) +それ以外では Perl は ISO 8859 シリーズのような単一バイトロケールのみに +対応しています。 +これはつまり、アジア言語のようなワイド文字ロケールには +対応していないということです。 +UTF-8 ロケール対応は実際には POSIX ロケールの上位集合です; +ロケールの影響を一切受けない完全な Unicode の振る舞いだからです +(例外は汚染です; L</SECURITY> を参照してください)。 +POSIX ロケールは、例え UTF-8 のものでも、 +文字の大文字小文字の変更が複数文字に拡張されるような、 +Unicode のいくつかの概念が欠けています。 +UTF-8 ロケールでは、Perl は拡張を提供します。 +UTF-8 ロケールについて、v5.20 より前の Perl では、 +一部のプラットフォームではある種の制限付きの ISO 8859-1 として扱い、 +その他のプラットフォームではより "C" ロケールに近いものになります。 +リリース v5.16 と v5.18 では、C<S<use locale 'not_characters>> が +これの回避策として使われていました (L</Unicode and UTF-8> を +参照してください)。 =begin original @@ -2329,13 +2324,13 @@ =end original -Tainting is also likely if the pattern is to be matched -case-insensitively (via C</i>). The exception is if all the code points -to be matched this way are above 255 and do not have folds under Unicode -rules to below 256. Tainting is not done for these because Perl -only uses Unicode rules for such code points, and those rules are the -same no matter what the current locale. -(TBT) +パターンが (C</i> を使って) 大文字小文字を無視してマッチングするような +ものである場合、おそらく汚染も起こります。 +例外は、この方法でマッチングする全ての符号位置が 255 より大きく、 +Unicode の規則の基で 256 より小さいものに畳み込みが行われない場合です。 +これらについては汚染は起こりません; なぜなら Perl はこのような符号位置に +対しては Unicode の規則のみを使い、この規則は現在のロケールに関わらず +同じだからです。 =begin original @@ -2559,13 +2554,11 @@ =end original -This environment variable, available starting in Perl v5.20, and if it -evaluates to a TRUE value, tells Perl to not use the rest of the -environment variables to initialize with. Instead, Perl uses whatever -the current locale settings are. This is particularly useful in -embedded environments, see -L<perlembed/Using embedded Perl with POSIX locales>. -(TBT) +この環境変数は Perl v5.20 から利用可能で、これが真の値に評価される場合、 +初期化のためのその他の環境変数を使わないように Perl に伝えます。 +代わりに、Perl は現在のロケール設定を使います。 +これは組み込み環境で特に有用です; +L<perlembed/Using embedded Perl with POSIX locales> を参照してください。 =item PERL_BADLANG @@ -2623,15 +2616,15 @@ 以下の環境変数は Perl に特有のものではなく、アプリケーションのデータの 扱いを制御するための標準的な(ISO C, XPG4, POSIX 1.c) C<setlocale()> メソッドの 一部分です。 -Windows is non-POSIX, -but Perl arranges for the following to work as described anyway. -If the locale given by an environment variable is not valid, Perl tries -the next lower one in priority. If none are valid, on Windows, the -system default locale is then tried. If all else fails, the C<"C"> -locale is used. If even that doesn't work, something is badly broken, -but Perl tries to forge ahead with whatever the locale settings might -be. -(TBT) +Windows は POSIX ではありませんが、Perl はそれでもここで記したとおりに +動作するように用意します。 +環境変数で与えられたロケールが正当ではない場合、 +優先順位で次のものを使おうとします。 +Windows では、正当なものがない場合、システムデフォルトロケールを +使おうとします。 +全てに失敗した場合、C<"C"> ロケールが使われます。 +これすらも動作しない場合、何かがひどく壊れていますが、 +Perl は何かロケール設定があるものとして前に進もうとします。 =over 12 @@ -3020,7 +3013,7 @@ "Internationalization" (国際化)はその最初と最後の文字、そしてその間にある 文字数から B<i18n> としばしば略されます。 -(なぜ(英語では) internalin ... internaliti ... i18n が良く省略されるか +(なぜ(英語では) internalin ... internaliti ... i18n が省略されがちか 推測できるかも知れません。) 同様のやり方で、"localization" もしばしば B<l10n> と省略されます。 @@ -3040,7 +3033,7 @@ =end original -国際対応は標準 C や標準 POSIX に定義されているように、不完全で、扱いにくく、 +標準 C や標準 POSIX に定義されている国際対応は、不完全で、扱いにくく、 粒度が大きすぎると酷評されます。 (ロケールは、単一のスレッドであるとか、ウィンドウグループといったものに対して 適用するのが便利であるときにもプロセス全体に適用されます)。 @@ -3152,14 +3145,14 @@ =end original -All the modules and switches just described can be used in v5.20 with -just plain C<use locale>, and, should the input locales not be UTF-8, -you'll get the less than ideal behavior, described below, that you get -with pre-v5.16 Perls, or when you use the locale pragma without the -C<:not_characters> parameter in v5.16 and v5.18. If you are using -exclusively UTF-8 locales in v5.20 and higher, the rest of this section -does not apply to you. -(TBT) +ここで記述されている全てのモジュールとスイッチは、 +v5.20 からは単に C<use locale> と書くだけで使えます; +入力が UTF-8 でなく、v5.16 より前の Perl を使うか、 +あるいは、v5.16 と v5.18 で +C<:not_characters> 引数なしで locale プラグマを使ったとき、 +理想とは遠い振る舞いになります。 +v5.20 以上で UTF-8 ロケールのみを使う場合は、この章の残りの内容は +適用されません。 =begin original @@ -3195,16 +3188,16 @@ =end original -The only multi-byte (or wide character) locale that Perl is ever likely -to support is UTF-8. This is due to the difficulty of implementation, -the fact that high quality UTF-8 locales are now published for every -area of the world (L<http://unicode.org/Public/cldr/latest/>), and that -failing all that you can use the L<Encode> module to translate to/from -your locale. So, you'll have to do one of those things if you're using -one of these locales, such as Big5 or Shift JIS. For UTF-8 locales, in -Perls (pre v5.20) that don't have full UTF-8 locale support, they may -十分にうまく動くかもしれません -(C ライブラリの実相に依存します); 単にこれらと +Perl が対応していると言える唯一のマルチバイト(ワイド文字)ロケールは +UTF-8 です。 +これは、実装の難しさ、高品質な UTF-8 ロケールは世界中のあらゆる +分野で使われているという事実、他のロケールと変換するために +L<Encode> モジュールを使えるというのが理由です。 +従って、Big5 や Shift JIS のようなこれらのロケールの一つを使っている場合、 +これらのどれか一つを行う必要があります。 +UTF-8 ロケールに関しては、完全な UTF-8 ロケール対応のない +(v5.20 より前の) Perl でも十分にうまく動くかもしれません +(C ライブラリの実装に依存します); 単にこれらと Perl はマルチバイトになる文字を同じ方法で保管するからです。 しかし、ほとんどではなかったとしても時々、C ライブラリ実装は、C<LC_CTYPE> の 下では Latin-1 の範囲の上半分 (128 - 255) の文字を正しく扱えません。 @@ -3215,7 +3208,6 @@ 動作するかもしれません。 しかし、これらは単一バイトロケールのように扱われ、後述するような 制限があります。 -(TBT) =begin original @@ -3474,7 +3466,7 @@ Translate: KIMURA Koichi Update: SHIRAKATA Kentaro <argra****@ub32*****> (5.8.8-) -Status: in progress +Status: completed =end meta