UI strings
Extract t() calls from JS, TS, and Astro. Generate flat per-locale JSON for i18next or static SSG lookup.
One config file, three translation modes, and the provider you choose — OpenAI, Anthropic, Gemini, OpenRouter, Ollama, or any OpenAI-compatible API. Switch models per project or per locale without rewriting your codebase.
The published package is ESM-only. Node.js >=22.16.0 required.
pnpm add ai-i18n-tools
# Set API key for your active provider — see preset table (default init: openrouter)
export OPENROUTER_API_KEY=sk-or-v1-your-key-here
ai-i18n-tools init [-P <provider>]
ai-i18n-tools syncSee Installation for configuring the bare CLI command (including cloned-monorepo development) and Quick start for scaffold templates.
| Your content | Command |
|---|---|
Source code uses t() | UI strings — extract / translate-ui |
| Localized pages or docs sites | Documents — translate-docs |
| Standalone nested JSON locale files | JSON — translate-json |
SVG illustrations use a separate translate-svg path — not docs[].contentPaths. See What is ai-i18n-tools? for a full comparison.
-P overridesai-i18n-tools.config.json schemanpx degitIntegrating the package into your own project? Start with AI Agent Context. The repository README is a short GitHub/npm landing page that links here for detail.