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

feat: add disableCache flag #160

Closed sakulstra closed 4 years ago

sakulstra commented 4 years ago

~might~seem to be a solution to #78 ~, have to dog-feed it first though.~ Our frontend dev team reported that it works :man_shrugging: Implements the solution proposed by @NamPNQ - adding a dedicated flag to not cache files.

published a fork in case someone else might want to test this: https://www.npmjs.com/package/@sakulstra/babel-plugin-i18next-extract

smeevil commented 4 years ago

Very nice :) Anything left that is blocking the merge?

smeevil commented 4 years ago

@sakulstra I am using your fork and this seems to work fine for anything that is translated within the <Trans> tags, but it seems that anything translated with t still gets overridden. Is that something you can confirm, or is it a configuration issue at my side?

sakulstra commented 4 years ago

Sadly sth I can confirm - didn't have time to check it yet

gilbsgilbs commented 4 years ago

Thanks for the PR, and sorry I didn't look at it earlier :cry: .

Have you figured out a way since then? If I remember correctly, the real underlying issue isn't that easy to fix properly and is tight to how babel invokes plugins. I think the "cache" here (and unlike what the name "cache" usually suggests) isn't some kind of optimization but rather a workaround to keep state between Babel invocations of the plugin.

TBH, I'd just like to get rid of this cache completely and find some way to do the initialization and teardown at the right moments. But this needs some further investigations (if it's even possible).

sakulstra commented 4 years ago

Sadly no. We're using this with a not very text heavy app so for now we just live with the issue 😅

gilbsgilbs notifications@github.com schrieb am Mi., 30. Sept. 2020, 22:48:

Thanks for the PR, and sorry I didn't look at it earlier 😢 .

Have you figured out a way since then? If I remember correctly, the real underlying issue isn't that easy to fix properly and is tight to how babel invokes plugins. I think the "cache" here (and unlike what the name "cache" usually suggests) isn't some kind of optimization but rather a workaround to keep state between Babel invocations of the plugin.

TBH, I'd just like to get rid of this cache completely and find some way to do the initialization and teardown at the right moments. But this needs some further investigations (if it's even possible).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gilbsgilbs/babel-plugin-i18next-extract/pull/160#issuecomment-701636661, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBRL5LZZLOR3X7INI3HBCDSIOKQZANCNFSM4NFXQLOQ .

xDisfigure commented 4 years ago

Hello!

Here is a feature request to fix such cache issue: https://github.com/gilbsgilbs/babel-plugin-i18next-extract/pull/174

sakulstra commented 4 years ago

closing in favor of #174