VitaliiTsilnyk/NGettext

String with context doesn't get localized and added to the .po file

mstupar05 opened this issue · 1 comments

Hello,
i'm using NGettext library combined with T.cs example class to localize my C# code.

GetString and GetPluralString are working fine:
T._("Hello, World!");
T._n("You have {0} apple.", "You have {0} apples.", count, count);

But GetParticularString doesn't get translated, and there is no string generated in a .po file.
T._p("Context", "Hello, World!");

I'm not sure if that's a bug or i'm doing something wrong?
I'm using Windows and xgettext tool, downloaded from here:
https://sourceforge.net/projects/getgnuwin32/files/getgnuwin32/0.6.30/

This is how i'm generating po files:
"i know that keyword '_p:1c,2' should cover that case"

"C:\Program Files (x86)\GnuWin32\bin\xgettext.exe" -k_ -k_n:1,2 -k_p:1c,2 -k_pn:1c,2,3 --from-code=UTF-8 -LC# --no-location --omit-header -o"%projectDir%locale\en-US\LC_MESSAGES\newmessages.pot" -fprojectfiles.txt

"C:\Program Files (x86)\GnuWin32\bin\msgmerge.exe" --backup=none -U "%projectDir%locale\en-US\LC_MESSAGES\messages.po" "%projectDir%locale\en-US\LC_MESSAGES\newmessages.pot"

Thanks for your help.

Hi!
This is strange, I'm not sure where the problem may be. At first glance everything looks fine…
And I'm sorry, but I don't think I can help you with xgettext, NGettext have nothing to do with translation string extraction or the original GNU utilities like xgettext. It just provides .NET API to use already compiled translation files.
Have you tried Poedit? It has an extractor too, that might work. I'm using it myself without any issues with this configuration.