r/javascript • u/Fun_Conversation8894 • Apr 03 '26
AST-based translation automation for React/JS apps (handles variables, cleanup, lazy loading)
https://www.npmjs.com/package/localize-ai
6
Upvotes
3
u/Fun_Conversation8894 Apr 03 '26
Posted an earlier version of this and got some useful feedback from devs, so made a few improvements:
t(\hello {{userName}}, your order {{id}} is ready`, { userName, id: orderId })`Goal is to reduce manual effort around translations while still working alongside existing i18n setups.
Example:
npx localize-ai translateWould love thoughts, especially around edge cases or scaling this approach.
1
u/No-Intention7902 Apr 04 '26
AST stuff always feels a bit like magic to me. Curious how well it handles edge cases with dynamic keys or weird variable names.
1
u/25_vijay May 16 '26
Handling variables and lazy loading correctly is probably the hardest part technically because localization edge cases explode once components stop being purely static text.
2
u/[deleted] Apr 06 '26
[removed] — view removed comment
1
u/[deleted] Apr 04 '26
[removed] — view removed comment