1

文字列を国際化するために、この C# クラスを使用しています。

internal class T
{
    public static string _(string text) { /*...*/ }
    public static string _(string text, params object[] args) { /*...*/ }
    public static string _n(string text, string pluralText, long n) { /*...*/ }
    public static string _n(string text, string pluralText, long n, params object[] args) { /*...*/ }
    public static string _p(string context, string text) { /*...*/ }
    public static string _p(string context, string text, params object[] args) { /*...*/ }
    public static string _pn(string context, string text, string pluralText, long n) { /*...*/ }
    public static string _pn(string context, string text, string pluralText, long n, params object[] args) { /*...*/ }
}

文字列を抽出するために実行します:xgettext -k_ -k_n:1,2 -k_p:1c,2 -k_pn:1c,2,3 -LC# --omit-header --from-code=UTF-8 -o messages.pot -c -n -p PO ./TransClassOne.cs

TransClassOneのクラスは:

public class TransClassOne
{

    public string sayHello()
    {
        return Utils.T._("Hello!!");
    }

    public string sayHello(string person)
    {
        return String.Format(Utils.T._("Hello, {0}!!"), person);
    }

    public string sayHello(string person, int n)
    {
        return String.Format(Utils.T._n("Hello, {0} - once!!", "Hello, {0} - twice!!", n), person);
    }

    public string sayGoodBye()
    {
        return Utils.T._("Good Bye!!");
    }

    public string sayGoodBye(string person)
    {
        return String.Format(Utils.T._("Good Bye, {0}!!"), person);
    }

    public string sayGoodBye(string person, int n)
    {
        return String.Format(Utils.T._n("Good Bye, {0} - once!!", "Good Bye, {0} - twice or more!!", n), person);
    }
}

問題はHello, {0} - twice or more!!Good Bye, {0} - twice or more私のファイルには表示されませんmessages.pot

4

1 に答える 1