gilbsgilbs / babel-plugin-i18next-extract

Babel plugin that statically extracts i18next and react-i18next translation keys.

Home Page:https://i18next-extract.netlify.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[DOCS] remove leading underscores from context names

tomdohnal opened this issue · comments

Describe the bug

It's not a bug in the plugin per se but a "bug" in the docs.

In the default context section you use ['_male', '_female'] as the default values and ["_fruit", "_animal"] as an example user value.

The problem with that is the leading underscore before the values - if you actually provide values with leading underscores in your babel config, the plugin that prepend another underscore when extracting the translations. This leads to the translation keys having two underscores instead of one (e. g. "your translation key__female" instead of expected "your translation key_female"). And if you use the default context separator, which happens to be just one underscore, it breaks.

I'm happy to send a PR but I first wanted to discuss it with you as it might be intentional for some reason I overlooked :)

And thanks for your awesome plugin!

Hi, thanks for raising an issue. Sorry for the delay, I've been quite busy lately (and still am). I'll happily merge your PR 😄 .