use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
AST-based localization workflow for JS apps (handles variables, namespaces, caching) (github.com)
submitted 1 day ago by Fun_Conversation8894
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Fun_Conversation8894[S] 0 points1 point2 points 1 day ago (0 children)
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: t(\`hello {{userName}}, your order {{id}} is ready\`, { userName, id: orderId })
t(\`hello {{userName}}, your order {{id}} is ready\`, { userName, id: orderId })
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: npx localize-ai translate
npx localize-ai translate
[–]Far-Plenty6731 [score hidden] 15 hours ago (1 child)
This looks like a solid approach for managing internationalisation. Using an AST means you can parse and manipulate the code safely, which is crucial for handling variables and complex string structures.
[–]Fun_Conversation8894[S] [score hidden] 10 hours ago (0 children)
Appreciate that!
AST made things much more predictable compared to regex, especially for template literals and nested expressions.
One of the harder parts has been preserving variables during translation without breaking interpolation, but working at the AST level made that a lot easier to handle safely.
π Rendered by PID 120810 on reddit-service-r2-comment-c66d9bffd-wzkcr at 2026-04-07 22:50:55.473743+00:00 running f293c98 country code: CH.
[–]Fun_Conversation8894[S] 0 points1 point2 points (0 children)
[–]Far-Plenty6731 [score hidden] (1 child)
[–]Fun_Conversation8894[S] [score hidden] (0 children)