gilbsgilbs / babel-plugin-i18next-extract

Babel plugin that statically extracts i18next and react-i18next translation keys.
https://i18next-extract.netlify.com
MIT License
161 stars 37 forks source link

[DOCS] remove leading underscores from context names #164

Open tomdohnal opened 4 years ago

tomdohnal commented 4 years ago

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!

gilbsgilbs commented 4 years ago

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 :smile: .