Open aldipower opened 4 years ago
OK, the problem is that I already defined a singular definition of "Woche" somewhere else.
export const timespanTypeNameMap = {
[TimespanType.WEEK]: t`Woche`,
}
So this seems to be conflicting then and the latter 'ngettext' gets ignored without warning..
Ok, sorry to be overhasty, this wasn't the problem. Even if I remove the singular variants, the plural still does not show up.
Hi @aldipower! Seems like a bug, need to check that. Let's clarify the reproduce case. If I've got your point, this code block is not extracted by ttag-cli
:
import { ngettext, msgid } from 'ttag.macro';
export const timespanTypePluralNameFunc = {
[TimespanType.WEEK]: count => ngettext(msgid`Woche`, `Wochen`, count),
[TimespanType.MONTH]: count => ngettext(msgid`Monat`, `Monate`, count),
[TimespanType.YEAR]: count => ngettext(msgid`Jahr`, `Jahre`, count),
};
It's CRA?
You can also try to add --discover
option to ttag-cli. https://github.com/ttag-org/ttag-cli#update-opts-pofile-src
Hi @AlexMost !
Yes, it's CRA with ttag.macro.
Exactly, the above code block isn't extracted and does not show up in the .po. Interesstingly, when I change
[TimespanType.WEEK]: count => ngettext(msgid`Woche`, `Wochen`, count),
to
[TimespanType.WEEK]: count => ngettext(msgid`WocheTEST`, `WochenTEST`, count),
it shows up as expected.
When I run it with --discover ngettext
it doesn't make any difference.
Hm, that sound's interesting. I will appreciate if you could create some example repo. That would simplify the reproduce case for me.
Yes, let me try to reproduce it in a clean repo. Please hold the line. ;) Could take me a while..
Ok @AlexMost, that was easy to reproduce.
https://github.com/aldipower/ttag-test
Plural forms of src/test-map/index.js should show up in i18n/en.po after running npm run i18n-update, but the do not.
Hi,
I have the following code-block in my application, which is not detected by the parser and thus not included in the resulting .po-file:
Other functions with ngettext are working perfectly fine, f.ex. this is included and working:
Maybe it's not a bug and I do not understand the upper scope correctly? It is really unexpected anyway.
Acutally it is include in the .po file, but only as singular form: