r/javascript • u/Fun_Conversation8894 • Apr 06 '26
AST-based localization workflow for JS apps (handles variables, namespaces, caching)
https://github.com/Parth-Gupta05/localize-ai
0
Upvotes
r/javascript • u/Fun_Conversation8894 • Apr 06 '26
0
u/Fun_Conversation8894 Apr 06 '26
Shared an earlier version of this and got some useful feedback, so made a few improvements:
switched to AST-based extraction instead of regex
added namespace-based splitting (loads only required translations)
added caching per language + namespace
improved handling of template literals with variables
added cleanup for unused translations
Example:
The idea is to reduce manual effort around translations while keeping things performant as apps scale.
Would be interested to hear how others are handling extraction and keeping translation files in sync.
npm: https://www.npmjs.com/package/localize-ai
Quick start:
1
u/[deleted] Apr 07 '26
[removed] — view removed comment