New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

vite-plugin-shipi18n

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-shipi18n

Vite plugin for automatic i18n translation at build time — bring your own OpenAI/Anthropic key. No hosted API.

latest
Source
npmnpm
Version
2.0.2
Version published
Maintainers
1
Created
Source

vite-plugin-shipi18n

Automatically translate your i18n locale files at build time — bring your own LLM. Uses your own OpenAI or Anthropic key via @shipi18n/core. No Shipi18n account, no hosted API, no per-word fees.

npm i -D vite-plugin-shipi18n @shipi18n/core @anthropic-ai/sdk
# or, for OpenAI:  npm i -D vite-plugin-shipi18n @shipi18n/core openai

Usage

// vite.config.js
import { defineConfig } from 'vite'
import shipi18n from 'vite-plugin-shipi18n'

export default defineConfig({
  plugins: [
    shipi18n({
      provider: 'anthropic',            // 'anthropic' (default) | 'openai' | custom adapter
      // apiKey: process.env.ANTHROPIC_API_KEY,  // optional — falls back to the provider env var
      targetLanguages: ['es', 'fr', 'de', 'ja'],
      sourceDir: 'public/locales/en',
      outputDir: 'public/locales',
    }),
  ],
})
export ANTHROPIC_API_KEY=sk-ant-...
vite build

On buildStart, every JSON file in sourceDir is translated into each target language and written to outputDir/<lang>/<file>, preserving structure and placeholders.

Options

OptionDefaultDescription
provider'anthropic''anthropic', 'openai', or a custom { complete } adapter
apiKeyenv varLLM key; falls back to ANTHROPIC_API_KEY / OPENAI_API_KEY
modelprovider defaultOverride the model
targetLanguages—Required. Array of language codes (['es','fr'])
sourceDir'public/locales/en'Directory of source locale JSON files
outputDir'public/locales'Where translated <lang>/<file> are written
sourceLanguage'en'Source language code
cachetrueCache translations by content hash
cacheDirnode_modules/.cache/vite-plugin-shipi18nCache location
fallback.fallbackToSourcetrueUse source text when a translation is missing
fallback.regionalFallbacktruept-BR → pt base-language fallback

Caching

Translations are cached by an MD5 of the source content + target languages. Change the source (or the target list) and only the affected files are re-translated on the next build.

Bring your own LLM

Your key is used to call your LLM directly — nothing is sent to a Shipi18n server. Set ANTHROPIC_API_KEY (default) or use provider: 'openai' with OPENAI_API_KEY.

License

Apache-2.0

Keywords

vite

FAQs

Package last updated on 16 Sep 2026

Related posts