I'm using this C# class in order to internationalize my strings:
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) { /*...*/ }
}
I perform for extracting strings: 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
My TransClassOne
class is:
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);
}
}
The problem is Hello, {0} - twice or more!!
and Good Bye, {0} - twice or more
doesn't appear on my messages.pot
file.
Your command looks good. It could be a bug in the xgettext tool you're using. What version of xgettext are you using? I had a similar problem with version 0.14
; now I'm using version 0.19
it's all good. Try downloading it from here https://mlocati.github.io/articles/gettext-iconv-windows.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.