Open eric-burel opened 3 years ago
Hey thanks for the PR. I'll look into it in ~2 weeks as I'm currently on vacation. Please remind me if I forget 😊.
Enjoy the vacations! And thanks for this package in the first place, the contributor experience is outstanding given how complex a Babel plugin can be, the testing in particular is great.
That one comment really made my day 🥲. Thanks.
This PR brings an improvement to the "variable keys" scenarion (https://i18next-extract.netlify.app/#/faq?id=how-to-deal-with-variable-keys).
It lets you define object keys that will systematically be considered as i18n token. It works exactly like a
t
function call, with custom names for the function, but using an object field instead.Limitations:
const myItem = { i18nToken: "foobar" }; t(myItem.i18nToken); // will trigger a false positive warning
{ i18nToken: "foobar"}
is supported but not{ i18nToken: ["foobar", { someValue: 42 } ]
. It could be easily extended by considering the token value exactly liket
function arguments but I am not familiar enough with both i18n and this plugin.