Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mstupar05 opened this issue Jul 1, 2021 · 1 comment
Open

Comments

@mstupar05
Copy link

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.

@VitaliiTsilnyk
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants