text/x-gettext-translation

text/x-gettext-translation

[28] POファイルは、 プログラム等で利用する文字列データの記述形式です。 多言語対応のためプログラム文字列を分離する際に使われています。

[2] GNU `gettext' utilities ( 版) https://www.gnu.org/software/gettext/manual/gettext.html#index-files_002c-_0040file_007b_002epo_007d-and-_0040file_007b_002emo_007d-29

The letters PO in .po files means Portable Object, to distinguish it from .mo files, where MO stands for Machine Object. This paradigm, as well as the PO file format, is inspired by the NLS standard developed by Uniforum, and first implemented by Sun in their Solaris system.

構文

[12] POファイルの構文解析を参照してください。

拡張

[4] KDE 日本語翻訳プロジェクト KDE の独自拡張 ( 版) http://www.kde.gr.jp/document/po/index.php#KDEorig

[9] Locale::Maketext::Lexicon::Gettext - PO and MO file parser for Maketext - search.cpan.org ( 版) http://search.cpan.org/~drtech/Locale-Maketext-Lexicon-0.77/lib/Locale/Maketext/Lexicon/Gettext.pm

頭部

[26]

エントリー内

Charset

[3] Re: gettext-0.10.38 について ( 版) http://mail.gnome.gr.jp/ml/gnome-translation/200106/msg00005.html

0.1.36 から multibyte が正しく処理されるようになった、ということです よね。

で、shift_jis っぽい encoding である big5 では single byte の encoding として処理された時の不具合を避けるために、文字によっては \ を 入れてた、というのがありました。それが最近の gettext では問題となる、 ということのようです (shift_jis の文字列を C のコードに埋め込む場合に 「表」を「表\」にするような...)。

euc-jp でも何か問題がありましたかね。文字の上位バイトと下位バイトが 別々の行に泣き別れになってる ja.po の場合にはなにかありそうですが、そ れかな。

[10] Locale::Maketext::Simpleのハマリどころ - Kitano’s Ramblings on Sillicon Valley ( 版) http://d.hatena.ne.jp/t-kitano/20070528/1180334424

Content-Type:Content-Transfer-Encoding: の左右が utf8旗に影響を与えるらしいです。

実装

[5] Ruby-GetText-Package - YotaLab Storage ( 版) http://www.yotabanana.com/hiki/ruby-gettext.html

[6] Locale::PO - Perl module for manipulating .po entries from GNU gettext - search.cpan.org ( 版) http://search.cpan.org/~ken/Locale-PO-0.21/PO.pm

[7] >>6ライセンス不詳なのが痛い。

[8] Steffen Winkler / DBD-PO-2.04 - search.cpan.org ( 版) http://search.cpan.org/~steffenw/DBD-PO-2.04/

[11] Text::Po::Parser というのもありましたが、なぜか CPAN からは削除されているみたいですね。探せば出てきますが。 2006年のものみたいです。

[13] PO Viewer ( 版) http://suika.fam.cx/~wakaba/-temp/test/po/tools/live

msgfmt + msgunfmt の結果を見れます。

[18] >>17>>13 のソースコード。 >>13 はもう動作しない。

[19] POEditor - Software translation management app ( 版) https://poeditor.com/

[20] ITS Tool | XML to PO and back again ( 版) http://itstool.org/

[23] Online PO file editor - Powered by Loco ( 版) https://localise.biz/free/poeditor

[24] Compiling translations ( 版) https://angular-gettext.rocketeer.be/dev-guide/compile/

POT

[22] 翻訳した文字列データを含まない空の状態の PO ファイルを特に POT (PO template) と呼んでいます。

[30] GNU gettext utilities ( 版) http://www.gnu.org/software/gettext/manual/gettext.html#Template

After preparing the sources, the programmer creates a PO template file.

[31] GNU gettext utilities ( 版) http://www.gnu.org/software/gettext/manual/gettext.html#index-creating-a-new-PO-file

When starting a new translation, the translator creates a file called LANG.po, as a copy of the package.pot template file with modifications in the initial comments (at the beginning of the file) and in the header entry (the first entry, near the beginning of the file).

MIME 型

[14] MIME型text/x-po が用いられます。 charset 引数が指定されることもあります。

[33] POファイルtext/x-gettext-translationPOTファイルtext/x-gettext-translation-template も使われるようです。

拡張子

[15] POファイルファイル名拡張子には .po が用いられます。

[32] POTファイルファイル名拡張子には .pot が使われるようです。

関連

[27] コンパイルしてMOファイルにすることがあります。

[29] gettext 本来の想定利用方法は MOファイルにコンパイルしたものをプログラムから読み込む方式なのでしょうが、 POファイルを直接読み込む実装や、 それ以外のデータ形式に変換しておく実装もあります。

メモ

[21] ITS and PO | ITS Tool ( 版) http://itstool.org/documentation/its-and-po/

[25] Apps/Gtranslator - GNOME Wiki! ( 版) https://wiki.gnome.org/Apps/Gtranslator