i18next / i18next-gitbook

165 stars 172 forks source link

Mention babel-plugin-i18next-extract in utils #92

Closed gilbsgilbs closed 5 years ago

gilbsgilbs commented 5 years ago

Hi,

I wasn't satisfied with existing static extraction tools for i18next. I tried i18next-scanner and i18next-parser and they both completely or partially rely on dirty regular expressions, have incomplete support for namespaces, have a very naive implementation of contexts (supporting only _male and _female suffixes, missing what context really is about). i18next-parser seemed slightly better to me (although it does rely on regexes for some processing), still it requires to configure another parser (acorn) from scratch which I didn't want to do because Babel is already setup almost everywhere.

For those reasons, I decided to come up with my very own solution based on Babel plugin API. This is a personal project that I tried on a tiny react project we have at work. I'd like to get some attention from the community to see if it can also solve problems other people may encounter or have encountered and if it's worth improving it further. In particular, I think what I called comment hints might be useful to some.

Let me know if you like it and if you'd like to include it in the gitbook :smile: .

Keep up the great work :+1: .

jamuhl commented 5 years ago

That's awesome 👍 - Sure, if you like provide a PR for both or I will add this in the next days:

https://react.i18next.com/guides/extracting-translations#2-using-an-extraction-tool

https://www.i18next.com/overview/plugins-and-utils#utils --> if doing a PR would you mind making a new section above utils called extraction tools containing yours and the two others?

Also you might do some tweets - mention me @jamuhl and I will retweet them.

jamuhl commented 5 years ago

great, thank you again - looking forward to users feedback on the new option you provided

gilbsgilbs commented 5 years ago

Many thanks to you @jamuhl .