Menu

1 / 2

How We Turn a Next.js App's Hardcoded Strings Into a Reviewed i18n Pull Request

DEV Community: nextjs·Mohit Sapat·4 days ago
#9uRJYzgH
#devtonextjs#devto#dev#var_0#babelize
Reading 0:00
15s threshold

TL;DR: Babelize parses every file with a Babel AST, extracts only user-facing text (whole JSX sentences become ICU messages with placeholders, tags and plurals), names keys from the file path and first words, hashes source text into a lockfile so reruns only translate what changed, validates every LLM translation for lost placeholders, broken ICU and untranslated output, then rewrites components to use next-intl and opens a diff or pull request for review.

Every React app starts with hardcoded text, and nobody wants to spend a sprint moving 900 strings into JSON files by hand. This is how Babelize does it: an AST pass that finds the text worth translating, keys that stay stable between runs, a lockfile so reruns cost nothing, an LLM whose output we refuse to trust, and a code rewrite that keeps your formatting.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.