Closed matpen closed 4 years ago
Hi @matpen! Thanks for the report, need to check that.
My pleasure! Thank you for the attention!
I guess the trouble is in require
. If you will change require
to import
- it works. Will try to figure out what is wrong with requrie
discoverage.
That thing is extracted - ok:
import { t, ngettext, msgid } from 'ttag';
function startCount(n){
console.log(t`starting count up to ${n}`); // using 't' tag for 1 to 1 translations
for (let i = 0; i <= n; i++) {
// use ngettext function for handling plural forms
console.log(ngettext(msgid`${i} tick passed`, `${i} ticks passed`, i));
}
}
This is an interesting find. Indeed, if we change the extract command to
./node_modules/.bin/ttag extract --discover=t --discover=ngettext --discover=msgid counter.js
it works even with the latest version of ttag-cli
.
So the problem must be somewhere in the interaction of the babel plugin with require
.
fixed in ttag-cli@1.8.1
. Have checked that locally, seems like it works. Thanks for the report and, please, let me know if you will encounter some more issues!
I just tested 1.8.2
and it seems to work correctly! Thank you for working on that!
I am just approaching
ttag
for the first time (thank you for the nice library, by the way) and setting up some experiments. I just noticed some strange behavior withttag-cli
: it seems like all versions from1.5.0
to1.8.0
fail to extract translations, while1.3.0-1
and1.4.0
work correctly.For this experiment I am using the quickstart example, which I clone directly from github, but I tried with other simple JavaScript files, with same results: