Localizer is a VS Code extension that helps you build and maintain JSON-based i18n for modern web apps. It supports React/Next.js, Vue/Nuxt, and Laravel/Blade projects, with automatic string extraction, safe rewrites, and AI-assisted translations.
-
Cross-framework i18n IntelliSense
Hover, go to definition, and completions for translation keys in:- JavaScript / TypeScript
- React (
.jsx/.tsx) - Vue single-file components (
.vue) - Laravel Blade / PHP views
-
Automatic extraction scripts
Scan your source code and templates to build grouped locale JSON files underresources/js/i18n/auto. -
Safe rewrite scripts
Replace hard-coded UI strings in React, Vue templates, and Blade views with i18n helpers (t('...'),$t('...'),__('...')) using existing locale keys. -
Auto-monitoring for new code (NEW!)
Automatically detects when you write new code with translatable content and triggers extraction/rewrite when files are committed to git. Enabled by default. -
AI-assisted translations (optional)
Use OpenAI to generate translations for non-default locales during "convert selection to key" and when fixing untranslated strings. -
Per-project configuration
Configure locales, source root, and npm scripts via a guided command. -
Status bar integration
Quick access to settings and monitoring status via the status bar icon.
- Install the extension from the VS Code Marketplace (search for
"Localizer – AI i18n for React, Vue & Laravel"), or use
Extensions: Install from VSIX... with a packaged
.vsixfile. - Open a workspace that contains your app (React/Next.js, Vue/Nuxt, or Laravel).
- Optionally configure your OpenAI API key for AI-assisted translations.
For contributors and detailed development instructions (cloning the repo, running in an Extension Development Host, building
.vsixpackages), seedev.md.
- Install Localizer – AI i18n for React, Vue & Laravel in VS Code or your VS Code–compatible IDE.
- Open your React/Next.js, Vue/Nuxt, or Laravel project.
- Run AI Localizer: Configure Project i18n to set up locales, source roots, and i18n scripts.
- Run AI Localizer: Rescan Translations to index your locale JSON files.
- In your code:
- Hover over translation keys for quick previews.
- Use Go to Definition to jump to the underlying JSON file.
- Use AI Localizer: Apply translations to selection to turn UI text into i18n keys with AI-assisted translations.
- Run AI Localizer: Ask AI for Help from the Command Palette, or
- Right-click in the editor and choose AI Localizer: Ask AI for Help.
Localizer does not answer directly. Instead it generates a high-quality prompt based on your current file/selection and tries to inject it into your existing AI chat UI.
If Localizer cannot inject into a chat UI, it will show a modal that lets you copy the generated prompt or open it in a document for manual copy/paste.
Ask AI is only shown when OpenAI translations are not enabled (i.e.
ai-localizer.i18n.autoTranslateis off, or no OpenAI API key is configured).
By default, the extension indexes translation JSON files matching
ai-localizer.i18n.localeGlobs and provides hover/definition/completions for
keys in the following languages:
javascript,typescript,javascriptreact,typescriptreactvueblade,php
You can rescan keys at any time via the command:
- AI Localizer: Rescan Translations (
ai-localizer.i18n.rescan)
Run the command:
- AI Localizer: Configure Project i18n (
ai-localizer.i18n.configureProject)
This will:
- Locate your project
package.json. - Add npm scripts (if missing):
i18n:extract– runscripts/extract-i18n.jsi18n:rewrite– runscripts/replace-i18n.jsi18n:rewrite-blade– runscripts/rewrite-i18n-blade.js(Laravel views)i18n:sync– sync non-default locales with the base localei18n:fix-untranslated– generate reports of untranslated strings
- Prompt for a comma-separated list of locales and store them in
package.jsonunderaiI18n.locales. - Offer to set
aiI18n.srcRoot(e.g.resources/jsorsrc), which controls which source tree the scripts scan. - Copy the helper scripts and
i18n-ignore-patterns.jsoninto your projectscripts/folder.
Once configured, you can run the scripts with npm:
npm run i18n:extract
npm run i18n:rewrite
npm run i18n:rewrite-blade # Laravel views
npm run i18n:sync
npm run i18n:fix-untranslated- Configure the project (AI Localizer: Configure Project i18n).
- Run
npm run i18n:extractto build groupedenlocale files underresources/js/i18n/auto/enorsrc/i18n/auto/en(depending onsrcRoot). - Optionally run
npm run i18n:rewriteto replace hard-coded JSX strings witht('Namespace.kind.slug')calls. The script:- Adds
import { t } from '@/i18n'if needed. - Preserves JSX layout and whitespace as much as possible.
- Adds
- Use IntelliSense in your code:
- Hover on
t('...')keys for translations. F12/ "Go to Definition" jumps to the locale JSON file.- Autocomplete suggests known keys.
- Hover on
You can also use AI Localizer: Copy React Language Switcher Component to scaffold
an example LanguageSwitcher and React i18n runtime/hooks.
- Configure the project.
- Run
npm run i18n:extract:- Extracts from
.ts/.tsx/.js/.jsxas in React. - Additionally scans
.vue<template>blocks for simple<Tag>Text</Tag>nodes and records them as translations.
- Extracts from
- Run
npm run i18n:rewrite:- For
.vuefiles, rewrites<Tag>Text</Tag>to<Tag>{{$t('Namespace.kind.slug')}}</Tag>when a matching key exists.
- For
- Use IntelliSense on
$t('...')calls inside.vuefiles.
- Configure the project (typically
resources/jsandresources/views). - Run
npm run i18n:extract:- Extracts React/Vue front-end strings under
resources/js. - Scans
resources/views/**/*.blade.phpand.phpfor simple<Tag>Text</Tag>nodes and records them as translations.
- Extracts React/Vue front-end strings under
- Run
npm run i18n:rewrite-blade:- Rewrites matching view literals to
{{ __("Namespace.kind.slug") }}when a key exists in the baseenlocale tree.
- Rewrites matching view literals to
- In Blade/PHP files you can also use:
- AI Localizer: Convert Selection to Translation Key to turn selected text
into a
__('...')call and automatically create the key in JSON files.
- AI Localizer: Convert Selection to Translation Key to turn selected text
into a
The extension reads these settings under ai-localizer:
ai-localizer.openaiApiKey– OpenAI API key used for AI-powered translations.ai-localizer.openaiModel– model ID (e.g.gpt-4o-mini).ai-localizer.i18n.autoTranslate– whentrue, automatically calls OpenAI to suggest translations for non-default locales when converting a selection to a key.
ai-localizer.askAI.forwardToCommand– Optional VS Code command ID to forward Ask AI prompts to (for example, a chat command from Windsurf/Cursor/Copilot). When set, Localizer will execute this command with the generated prompt.
If you’re using VS Code’s built-in chat UI (for example via GitHub Copilot Chat), you can try:
workbench.action.chat.open
Third-party extension command IDs may change between versions and may not be publicly documented. If you don’t know the command ID, leave this setting empty and Localizer will try to auto-detect a suitable chat command; if that fails it will show the prompt for manual copy/paste.
ai-localizer.i18n.autoMonitor– Enable automatic monitoring of files for translatable content (default:true).ai-localizer.i18n.autoExtract– Automatically run extraction when new content is detected and committed (default:true).ai-localizer.i18n.autoRewrite– Automatically run rewrite after extraction (default:true).
ai-localizer.i18n.defaultLocale– Default locale (default:en).ai-localizer.i18n.localeGlobs– Glob patterns for locale JSON files.ai-localizer.i18n.tImportPath– Import path for translation helper (default:@/i18n).
Example (user or workspace settings):
- VS Code
^1.60.0 - Node.js for running the i18n scripts (
node ./scripts/*.js) - (Optional) OpenAI API key for AI-assisted translations
- Fix hover tooltips so they list all project locales and flag missing translations.
- Fix bulk restore similarity issues
- Improve performance
- Add cleanup unused and orphaned keys command.
- Fix laravel missing key bulk fix.
- Fix hover tooltips so they list all project locales and flag missing translations.
- Fix missing locale diagnostics.
- Improve file specific diagnostics detections.
- Add debug logging settings.
- Fix existing scripts detection.
- Fix diagnostics shortfalls.
- Add auto fix for missing default translations.
- Fix stringPattern issue.
- Fix script version checks
- Fix missing translation analysis
- Enable auto ai prompting.
- Stale script update.
- Improved selection commands.
- Add eslint.
- Refactor code for easier maintenance.
- Fix PHP language file handling.
- Fix incorrect key recovery strategy.
- Fix invalid cleanup issues arising from auto ignore patterns.
- Fixes for laravel go-i18n style catalogs. Added Python, C# and GoLang support.
- Major refactors, verified robust support for React and Vue based frameworks. Added one command to fix all issues.
- Initial release of Localizer – AI i18n for React, Vue & Laravel
Enjoy!
{ "ai-localizer.openaiApiKey": "sk-...", "ai-localizer.openaiModel": "gpt-4o-mini", "ai-localizer.i18n.autoTranslate": true, "ai-localizer.i18n.autoMonitor": true, "ai-localizer.i18n.autoExtract": true, "ai-localizer.i18n.autoRewrite": true, "ai-localizer.i18n.defaultLocale": "en", "ai-localizer.i18n.localeGlobs": [ "resources/js/i18n/auto/**/*.json", "src/i18n/**/*.json" ] }