国際化(i18n)
Internationalization
アプリケーションの国際化(略してi18n)とは、
テキストメッセージを別のメッセージに単に翻訳すること以上に、もう一つの意味
--
日付、時間そして、通貨フォーマットもまた変更することを必要とします、
いくつかの言語は左から右へ、他の言語においては右から左に記述し、
文字エンコーディングにもまた違いがあるかもしれません、
そして、他に多くの部分もまた変更することを必要とするかもしれません。
--
を含むとはいえ、それが、必要な最初のステップです。
wxWidgets は、メッセージの翻訳の為に
wxLocale クラスを供給し、
それにより充分にいくつかの言語に翻訳されます。
最新の翻訳については wxWidgets ホームページを参照してください。
もしあなたが、まだ行われていない言語の一つを翻訳するのならば、
あなたの翻訳は、ライブラリの将来のバージョンに含めるために感謝と共に受け入れられるでしょう。
Although internationalization of an application (i18n for short) involves far
more than just translating its text messages to another message -- date, time and
currency formats need changing too, some languages are written left to right
and others right to left, character encoding may differ and many other things
may need changing too -- it is a necessary first step. wxWidgets provides
facilities for message translation with its
wxLocale class and is itself fully translated into several
languages. Please consult wxWidgets home page for the most up-to-date
translations - and if you translate it into one of the languages not done
yet, your translations would be gratefully accepted for inclusion into the
future versions of the library!
i18n への wxWidgets のアプローチは、密接に GNU gettext パッケージに依存します。
wxWidgets は、gettext カタログとバイナリ互換性を持つメッセージカタログを使用します、
そして、これによってそのパッケージの中で全てのプログラムが動作することができます。
しかし、あなたが配布するメッセージカタログ以外、
追加のライブラリが実行時に必要とされない点に注目してください。
The wxWidgets approach to i18n closely follows GNU gettext package. wxWidgets uses the
message catalogs which are binary compatible with gettext catalogs and this
allows to use all of the programs in this package to work with them. But note
that no additional libraries are needed during the run-time, however, so you
have only the message catalogs to distribute and nothing else.
プログラム開発の間、あなたは gettext パッケージをメッセージカタログを動作させるために必要とします。
警告:
gettext バージョン < 0.10 はバグが多いため、それ以降のバージョンを使用してください!
During program development you will need the gettext package for
working with message catalogs. Warning: gettext versions < 0.10 are known
to be buggy, so you should find a later version of it!
拡張子 .po をもつテキストファイルであるソースカタログと、
拡張子 .mo をもつソースから msgfmt プログラム
(gettext パッケージに含まれています)
により作成されるバイナリカタログの二種類のメッセージカタログがあります。
バイナリファイルは、プログラムを実行する間だけ必要とされます。
There are two kinds of message catalogs: source catalogs which are text files
with extension .po and binary catalogs which are created from the source ones
with msgfmt program (part of gettext package) and have the extension .mo.
Only the binary files are needed during program execution.
プログラム国際化は、いくつかのステップを必要とします:
The program i18n involves several steps:
-
Translating the strings in the program text using
wxGetTranslation or equivalently the _() macro.
-
前のステップで完了した作業を利用します、なぜなら、
xgettext プログラムは、文字列の抽出の為に
_() と wxGetTranslation を認識し
(-k オプションを使用します)
、そして、それらの関数呼び出しの中の文字列を全て抽出します。
それか、あなたは全てのストリングを抽出するために -a オプションを使用することもできます、
しかし、その場合まったく翻訳する必要のない多くの文字列を含むことになります。
この作業により、テキストメッセージカタログ (.po ファイル) が作成されます。
Extracting the strings to be translated from the program: this uses the
work done in the previous step because xgettext program used for string
extraction may be told (using its -k option) to recognise _() and
wxGetTranslation and extract all strings inside the calls to these functions.
Alternatively, you may use -a option to extract all the strings, but it will
usually result in many strings being found which don't have to be translated at
all. This will create a text message catalog - a .po file.
-
前のステップで抽出した文字列を他の言語に翻訳します。
これは、.po ファイルを編集するということを意味します。
Translating the strings extracted in the previous step to other
language(s). It involves editing the .po file.
-
プログラムを使用して .po ファイルを .mo ファイルにコンパイルします。
Compiling the .po file into .mo file to be used by the program.
-
文字列によって言語を与え、あなたのプログラムの中で適切なロケールを設定します。
詳しくは
wxLocale を参照してください。
Setting the appropriate locale in your program to use the strings for the
given language: see
wxLocale.
また、あなたの wxWidgets ディストリビューションの中の
docs/html/index.htm
からリンクされた GNU gettext ドキュメントもご覧下さい。
See also the GNU gettext documentation linked from docs/html/index.htm in
your wxWidgets distribution.
最後に、これがすべてどのように実際上見るかあなたに示す
i18n サンプル
をご覧下さい。
Finally, take a look at the
i18n sample which shows
to you how all this looks in practice.