【问题标题】:xgettext plural parameter string not extracted to POTxgettext 复数参数字符串未提取到 POT
【发布时间】:2016-01-21 19:41:28
【问题描述】:

我正在使用这个 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 文件中。

【问题讨论】:

    标签: c# localization internationalization gettext xgettext


    【解决方案1】:

    你的命令看起来不错。这可能是您正在使用的 xgettext 工具中的错误。您使用的是什么版本的 xgettext?我对version 0.14 有类似的问题;现在我正在使用version 0.19,一切都很好。尝试从这里下载它https://mlocati.github.io/articles/gettext-iconv-windows.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-14
      • 2011-12-13
      相关资源
      最近更新 更多