--extract-all
をxgettext
とすることは複数形では機能しません。ここでC++コードとしてI18n C++ hello world with pluralsへの答えを使用すると、xgettext
を使用する2つのテストがあります。--extract-allでxgettexttを使って複数形を扱う
cat >helloplurals.cxx <<EOF
// hellopurals.cxx
#include <libintl.h>
#include <locale.h>
#include <iostream>
int main(){
setlocale(LC_ALL, "");
bindtextdomain("helloplurals", ".");
textdomain("helloplurals");
for (int ii=0; ii<5; ii++)
printf(ngettext("Hello world with %d moon.\n", "Hello world with %d moons.\n", ii), ii);
EOF
xgettext --package-name helloplurals --package-version 1.1 --default-domain helloplurals --output helloplurals.pot helloplurals.cxx
xgettext --extract-all --package-name helloplurals --package-version 1.1 --default-domain helloplurals --output helloplurals-ea.pot helloplurals.cxx
複数形の扱いなど、予想通り--extract-all
作品なし1:--extract-all
が結果POTファイルにはないコマンドラインに追加され
#: helloplurals.cxx:10
#, c-format
msgid "Hello world with %d moon.\n"
msgid_plural "Hello world with %d moons.\n"
msgstr[0] ""
msgstr[1] ""
。
#: helloplurals.cxx:10
#, c-format
msgid "Hello world with %d moon.\n"
msgstr ""
#: helloplurals.cxx:10
#, c-format
msgid "Hello world with %d moons.\n"
msgstr ""
文字列リテラルxgettext
の最初の使用例に示すように、機能が適切に複数のメッセージを処理するようgettext()
に直接渡される。代わりに個別のエントリがあります。 xgettext
とオプション--extract-all
の使用はPOTファイルのエントリを生成するために使用することができます 機能のようなgettext()
の1つに直接渡されていない文字列リテラルの場合
。 msgid_plural
とmsgstr[]
:
どのようにしても、複数のエントリを生成する関数のようgettext()
に直接渡された複数の文字列リテラルを含むソース内の関数のようなgettext()
に直接渡されていない文字列リテラルの取り扱いを取得していますか?