
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
localize-ai
Advanced tools
AI-powered React localization with AST-based extraction, namespace-based loading, smart caching, debug mode and multi-provider support
AI-powered React localization with AST-based extraction, namespace-based loading, and smart caching β‘
π No regex. No manual cleanup. Just accurate and scalable translations.
Context-aware AI localization with multi-provider support β‘
Automatically extract, translate, and serve multilingual UI β powered by AI β‘
Designed for performance: no unnecessary data, no re-fetching, minimal bundle impact.
Namespace-based splitting
β Each language is split into namespaces (common.json, dashboard.json, etc.)
Lazy loading
β Only loads required namespace instead of entire language
Caching
β Prevents repeated fetches per language + namespace
π This ensures fast load times and minimal bundle size.
Localize-ai uses AST parsing instead of regex, ensuring accurate extraction:
Example:
t(`hello {{userName}}, your order {{id}} is ready`, {
userName,
id: orderId
});
π Variables are preserved and translated correctly.
Localize-ai supports namespace-based translation splitting for large applications:
public/
βββ locales/
βββ en/
β βββ common.json
β βββ dashboard.json
β βββ checkout.json
β βββ ...
βββ fr/
β βββ common.json
β βββ dashboard.json
β βββ ...
Why this matters:
π No more loading the entire language file at once.
Localize-ai caches translations per:
This ensures:
localize-ai provides a built-in debug mode to visualize translation status directly in your UI.
Enable debug mode:
<LanguageContextProvider debug={true}>
<App />
</LanguageContextProvider>
Behavior: π’ Translated strings β highlighted in green π‘ Missing translations β highlighted in custom color
Configure debug color:
// localize.config.js
export default {
sourceLanguage: "en",
translationLanguages: ["hi", "fr", "es", "ar"],
provider: "gemini",
apikey: "VITE_GEMINI_API_KEY",
debugColor: "yellow",
context: "Kit kat condolence message page"
};
π Helps quickly identify missing translations during development.
localize-ai supports a dry-run mode to preview the entire localization pipeline without writing any translations.
Run dry-run:
npx localize-ai translate --dry-run
What it does:
π§ͺ Running dry-run (no translations will be made)...
β Invalid template literal detected
π File: src/App.jsx
π Line: 82
π Use {{var}} instead of ${var}
β
Extraction complete with namespaces
β
Cleaned namespaces: 2
π Starting localization pipeline
βΉοΈ Provider: gemini
βΉοΈ Source Language: en
βΉοΈ Target Languages: hi, fr, es, ar
π Summary:
Total input strings: 22
π New strings: 0
π Missing translations: 0
β οΈ Partial translations: 0
Translated now: 0
Total stored translations: 22
β
Done
Why use dry-run? π‘οΈ Safe preview before running translations π Catch errors (like invalid template literals) π Understand translation coverage
π Ideal for CI checks and debugging.
npm install localize-ai
// localize.config.js
export default {
sourceLanguage: "en",
translationLanguages: ["hi", "fr"],
provider: "gemini", // or "openai"
apikey: "VITE_GEMINI_API_KEY",
context: "E-commerce checkout UI for buying products",
};
π Providing context improves translation accuracy by helping AI understand intent (e.g., "Charge" in payments vs battery).
VITE_GEMINI_API_KEY=your_api_key_here
npx localize-ai init
npx localize-ai translate
This will:
public/
βββ locales/
βββ en/
β βββ common.json
β βββ [namespace].json
β βββ ...
βββ fr/
β βββ ...
localize.runtime.json
import { LanguageContextProvider } from "localize-ai";
<LanguageContextProvider>
<App />
</LanguageContextProvider>;
const { t } = useTranslation("dashboard");
π Loads only dashboard.json for the active language.
const { t } = useTranslation();
π Uses common.json by default.
const { setLang } = useTranslation();
setLang("fr"); // switch language
npx localize-ai delete-sync
Localize-ai automatically removes unused translations:
π Prevents bloated translation files over time.
Code β AST Extract β Namespace Split β AI Translate β JSON β Lazy Load β Cache β UI
public/
βββ locales/
βββ en/
β βββ common.json
β βββ [namespace].json
β βββ ...
βββ fr/
β βββ ...
<h1>{t("Get started")}</h1>
β‘οΈ Automatically becomes:
{
"common": {
"Get started": "ΰ€Άΰ₯ΰ€°ΰ₯ ΰ€ΰ€°ΰ₯ΰ€"
}
}
npx localize-ai init # generate runtime config
npx localize-ai translate # extract + translate
npx localize-ai delete-sync # delete dead translations
npx localize-ai translate --dry-run # preview without writing files
| Feature | localize-ai | traditional i18n |
|---|---|---|
| Auto extraction | β | β |
| AST-based parsing (no regex) | β | β |
| AI translation | β | β |
| Incremental updates | β | β |
| Namespace-based loading | β | β οΈ manual |
| Lazy loading | β | β οΈ manual |
| Built-in caching | β | β |
| Dead translation cleanup | β | β |
| Context-aware translations | β | β |
| Setup time | β‘ minutes | β³ hours |
t("...") are extractedpublic/ folder existsPRs welcome! Feel free to open issues or suggest improvements.
MIT
Parth Gupta
If you like this project:
π Star the repo π Share with developers π Give feedback
FAQs
AI-powered React localization with AST-based extraction, namespace-based loading, smart caching, debug mode and multi-provider support
The npm package localize-ai receives a total of 35 weekly downloads. As such, localize-ai popularity was classified as not popular.
We found that localize-ai demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.