Registry / devops / auto-i18n-plugin-core

auto-i18n-plugin-core

JSON →
library1.1.16jsnpmunverified

auto-i18n-plugin-core is the core package for automatic i18n translation plugins supporting Vite, Webpack, Rollup, and Rsbuild. Version 1.1.16 provides shared logic for detecting and translating hardcoded strings in Vue/React projects without source code changes. It integrates multiple translation services (Youdao, Google, custom) and generates localized language packs. The package is TypeScript-typed and supports ESM and CJS. Key differentiators include zero-code-modification translation, smart text detection, and broad build tool compatibility. Release cadence is irregular; the ecosystem is maintained but small.

npm install auto-i18n-plugin-core
INSTALL
IMPORT
SIG · AUTO-I18N-PLUGIN-C
A
auto-i18n-plugin-core
devopsjavascriptv1.1.16
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import plugin from 'auto-i18n-plugin-core'
const plugin = require('auto-i18n-plugin-core')
Package supports ESM default export; CJS require usage may fail if not using bundler interop.
YoudaoTranslator
import { YoudaoTranslator } from 'auto-i18n-plugin-core'
import YoudaoTranslator from 'auto-i18n-plugin-core'
Named export for translator classes; default export is the plugin function.
GoogleTranslator
import { GoogleTranslator } from 'auto-i18n-plugin-core'
import { GoogleTranslate } from 'auto-i18n-plugin-core'
Export name is 'GoogleTranslator', not 'GoogleTranslate'. Check spelling.

Shows how to configure the plugin with Vite and Youdao translator, including environment variable usage.

// Install: npm install auto-i18n-plugin-core import plugin, { YoudaoTranslator } from 'auto-i18n-plugin-core'; // Use with Vite // vite.config.js import { defineConfig } from 'vite'; import vue from '@vitejs/plugin-vue'; export default defineConfig({ plugins: [ vue(), plugin({ // Required: translator instance translator: new YoudaoTranslator({ appId: process.env.YOUDAO_APP_ID ?? '', appKey: process.env.YOUDAO_APP_KEY ?? '' }), // Optional: target languages (default ['en', 'zh-cn']) targetLangList: ['en', 'zh-cn'] }) ] });
Debug
Known issues
gotchaYoudao translator requires valid appId and appKey from the Youdao translation service. Demo keys in examples are exhausted and won't work.
fix
Get your own Youdao API credentials from https://ai.youdao.com.
affects: >=1.0.0
gotchaLanguage switching via localStorage requires a full page reload unless using $changeLang. In React and Vue, changing lang and re-rendering components may not update all strings without reload.
fix
Use window.$changeLang('en') and force re-render the root component (e.g., toggle v-if on App).
affects: >=1.0.0
gotchaThe plugin detects only hardcoded strings that are not already wrapped in i18n functions. Strings in dynamic expressions or concatenated strings may be missed.
fix
Ensure translatable strings are literal strings in templates or JSX. Use explicit i18n keys for dynamic content.
affects: >=1.0.0
gotchaPlugin may not work with SSR frameworks (Nuxt, Next.js) out of the box. It is intended for client-side builds.
fix
Disable plugin during SSR or use client-only wrappers.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'auto-i18n-plugin-core'
Package not installed or import path incorrect.
fix
Run `npm install auto-i18n-plugin-core` and verify node_modules contains it.
TypeError: plugin is not a function
Default export imported incorrectly; likely used named export for the plugin function.
fix
Use `import plugin from 'auto-i18n-plugin-core'` instead of `import { plugin } from 'auto-i18n-plugin-core'`.
YoudaoTranslator is not a constructor
Named export 'YoudaoTranslator' not imported correctly; possibly typed as default import.
fix
Use `import { YoudaoTranslator } from 'auto-i18n-plugin-core'`.
Error: Cannot read property 'appId' of undefined
Translator configuration object missing or incorrect properties.
fix
Pass `new YoudaoTranslator({ appId: '...', appKey: '...' })` inside the plugin options object.
Upgrade
Version history
1.1.16latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
6
OpenAI (training)
2
Resources
auto-i18n-plugin-core — npm install auto-i18n-plugin-core · libregistry