{"id":40608,"library":"auto-i18n-plugin-core","title":"auto-i18n-plugin-core","description":"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.","status":"active","version":"1.1.16","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/wenps/auto-i18n-translation-plugins","tags":["javascript","i18n","auto i18n","vite i18n","webpack i18n","vue i18n","react i18n","typescript"],"install":[{"cmd":"npm install auto-i18n-plugin-core","lang":"bash","label":"npm"},{"cmd":"yarn add auto-i18n-plugin-core","lang":"bash","label":"yarn"},{"cmd":"pnpm add auto-i18n-plugin-core","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package supports ESM default export; CJS require usage may fail if not using bundler interop.","wrong":"const plugin = require('auto-i18n-plugin-core')","symbol":"default","correct":"import plugin from 'auto-i18n-plugin-core'"},{"note":"Named export for translator classes; default export is the plugin function.","wrong":"import YoudaoTranslator from 'auto-i18n-plugin-core'","symbol":"YoudaoTranslator","correct":"import { YoudaoTranslator } from 'auto-i18n-plugin-core'"},{"note":"Export name is 'GoogleTranslator', not 'GoogleTranslate'. Check spelling.","wrong":"import { GoogleTranslate } from 'auto-i18n-plugin-core'","symbol":"GoogleTranslator","correct":"import { GoogleTranslator } from 'auto-i18n-plugin-core'"}],"quickstart":{"code":"// Install: npm install auto-i18n-plugin-core\n\nimport plugin, { YoudaoTranslator } from 'auto-i18n-plugin-core';\n\n// Use with Vite\n// vite.config.js\nimport { defineConfig } from 'vite';\nimport vue from '@vitejs/plugin-vue';\n\nexport default defineConfig({\n  plugins: [\n    vue(),\n    plugin({\n      // Required: translator instance\n      translator: new YoudaoTranslator({\n        appId: process.env.YOUDAO_APP_ID ?? '',\n        appKey: process.env.YOUDAO_APP_KEY ?? ''\n      }),\n      // Optional: target languages (default ['en', 'zh-cn'])\n      targetLangList: ['en', 'zh-cn']\n    })\n  ]\n});","lang":"typescript","description":"Shows how to configure the plugin with Vite and Youdao translator, including environment variable usage."},"warnings":[{"fix":"Get your own Youdao API credentials from https://ai.youdao.com.","message":"Youdao translator requires valid appId and appKey from the Youdao translation service. Demo keys in examples are exhausted and won't work.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use window.$changeLang('en') and force re-render the root component (e.g., toggle v-if on App).","message":"Language 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure translatable strings are literal strings in templates or JSX. Use explicit i18n keys for dynamic content.","message":"The plugin detects only hardcoded strings that are not already wrapped in i18n functions. Strings in dynamic expressions or concatenated strings may be missed.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Disable plugin during SSR or use client-only wrappers.","message":"Plugin may not work with SSR frameworks (Nuxt, Next.js) out of the box. It is intended for client-side builds.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.1.16':27 'auto':2,7,96 'auto-i18n-plugin-core':1,6 'automat':16 'broad':80 'build':81 'cadenc':85 'chang':43 'cjs':67 'code':42,73 'compat':83 'core':5,10,13 'custom':51 'detect':32,78 'differenti':69 'ecosystem':89 'esm':65 'generat':53 'googl':50 'hardcod':35 'i18n':3,8,17,95,97,99,101,103,105 'includ':70 'integr':45 'irregular':87 'javascript':94 'key':68 'languag':55 'local':54 'logic':30 'maintain':91 'modif':74 'multipl':46 'pack':56 'packag':14,58 'plugin':4,9,19 'project':39 'provid':28 'react':104 'releas':84 'rollup':23 'rsbuild':25 'servic':48 'share':29 'small':93 'smart':76 'sourc':41 'string':36 'support':20,64 'text':77 'tool':82 'translat':18,34,47,75 'type':62 'typescript':61,106 'typescript-typ':60 'version':26 'vite':21,98 'vue':102 'vue/react':38 'webpack':22,100 'without':40 'youdao':49 'zero':72 'zero-code-modif':71","created_at":"2026-06-04T18:48:23.390284+00:00","updated_at":"2026-06-04T18:48:23.390284+00:00","problems":[{"fix":"Run `npm install auto-i18n-plugin-core` and verify node_modules contains it.","cause":"Package not installed or import path incorrect.","error":"Error: Cannot find module 'auto-i18n-plugin-core'"},{"fix":"Use `import plugin from 'auto-i18n-plugin-core'` instead of `import { plugin } from 'auto-i18n-plugin-core'`.","cause":"Default export imported incorrectly; likely used named export for the plugin function.","error":"TypeError: plugin is not a function"},{"fix":"Use `import { YoudaoTranslator } from 'auto-i18n-plugin-core'`.","cause":"Named export 'YoudaoTranslator' not imported correctly; possibly typed as default import.","error":"YoudaoTranslator is not a constructor"},{"fix":"Pass `new YoudaoTranslator({ appId: '...', appKey: '...' })` inside the plugin options object.","cause":"Translator configuration object missing or incorrect properties.","error":"Error: Cannot read property 'appId' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/wenps/auto-i18n-translation-plugins#readme","github":"ssh://git@github.com/wenps/auto-i18n-translation-plugins","docs":null,"changelog":null,"pypi":null,"npm":"auto-i18n-plugin-core","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}