vue-i18n-extract-plugin 1.0.64 → 1.0.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -65,11 +65,11 @@ const defaultOptions = {
65
65
  includePath: ['src/'], // 包含路径的数组
66
66
  excludedPath: [], // 排除路径的数组 refer to https://github.com/mrmlnc/fast-glob?tab=readme-ov-file#how-to-exclude-directory-from-reading
67
67
  allowedExtensions: [".vue", ".tsx", ".ts", ".jsx", ".js"], // 允许提取的文件扩展名
68
- generateId: null, // 自定义生成 key 的函数
69
68
  fromLang: 'zh-cn', // 源语言, 目前支持提取的语言有:zh-cn(zh-tw), en, ja, ko, ru
70
69
  translateLangKeys: ["zh-tw", "en"], // 需要翻译为的语言键
71
70
  i18nPkgImportPath: "@/i18n", // i18n语言包导入路径
72
71
  outputPath: "src/i18n", // 提取的语言包输出文件路径
72
+ generateId: null, // 自定义生成 key 的函数
73
73
  customGenLangFileName: langKey => langKey, // 自定义生成语言文件名
74
74
  // 翻译后的文本处理函数,方便对翻译后的文本进行二次加工,如每个单词首字母大写, params: text: 翻译后的文本, toLang: 翻译后的目标语言,translateLangKeys的枚举成员
75
75
  customTranslatedText: (text, toLang) => text,
package/lib/options.js CHANGED
@@ -19,11 +19,11 @@ const defaultOptions = {
19
19
  includePath: ["src/"], // 包含路径的数组
20
20
  excludedPath: [], // 排除路径的数组
21
21
  allowedExtensions: [".vue", ".tsx", ".ts", ".jsx", ".js"], // 允许提取的文件扩展名
22
- generateId: null, // 自定义生成 key 的函数
23
22
  fromLang: "zh-cn", // 源语言, 目前支持提取的语言有:zh-cn(zh-tw), en, ja, ko, ru
24
23
  translateLangKeys: ["zh-tw", "en"], // 需要翻译为的语言键
25
24
  i18nPkgImportPath: "@/i18n", // i18n语言包导入路径
26
25
  outputPath: "src/i18n", // 提取的语言包输出文件路径
26
+ generateId: null, // 自定义生成 key 的函数
27
27
  customGenLangFileName: langKey => langKey, // 自定义生成语言文件名
28
28
  // 翻译后的文本处理函数,方便对翻译后的文本进行二次加工,如每个单词首字母大写, params: text: 翻译后的文本, toLang: 翻译后的目标语言,translateLangKeys的枚举成员
29
29
  customTranslatedText: (text, toLang) => text,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-i18n-extract-plugin",
3
- "version": "1.0.64",
3
+ "version": "1.0.65",
4
4
  "main": "lib/index.js",
5
5
  "types": "types/index.d.ts",
6
6
  "bin": {
@@ -14,7 +14,7 @@ export function i18nImportAstTransform(
14
14
  export function i18nImportTransform(
15
15
  code: string,
16
16
  path: string,
17
- importName: string,
17
+ importNames: string[],
18
18
  importPath: string
19
19
  ): Promise<string>;
20
20
 
@@ -1,12 +1,18 @@
1
+ import { Translator } from './translators';
2
+
1
3
  export type LangKey = "zh-cn" | 'zh-tw' | 'en' | 'ja' | 'ko' | 'ru' | string
2
4
 
3
5
  export interface I18nOptions {
4
6
  translateKey: string
7
+ JSXElement: string
8
+ jsx: boolean
5
9
  rewrite: boolean
6
10
  extractFromText: boolean
7
11
  autoImportI18n: boolean
8
12
  autoTranslate: boolean
9
13
  cleanTranslate: boolean
14
+ keepRaw: boolean
15
+ keepDefaultMsg: boolean
10
16
  enabled: boolean
11
17
  outputJsonFileInPlugin: boolean
12
18
  outputJsonFileDebounceTimeInPlugin: number
@@ -22,13 +28,5 @@ export interface I18nOptions {
22
28
  generateId: ((text: string) => string) | null | undefined
23
29
  customGenLangFileName: (langKey: LangKey) => LangKey
24
30
  customTranslatedText: (text: string, toLang: LangKey) => string,
25
- // translator: new GoogleTranslator({
26
- // // proxyOption: {
27
- // // port: 7890,
28
- // // host: '127.0.0.1',
29
- // // headers: {
30
- // // 'User-Agent': 'Node'
31
- // // }
32
- // // }
33
- // })
31
+ translator: Translator
34
32
  };
@@ -26,6 +26,7 @@ interface TranslatorOption {
26
26
  */
27
27
  onError?: (err: unknown, defaultErrorHandler: (error: unknown) => void) => void;
28
28
  }
29
+
29
30
  declare class Translator {
30
31
  option: Required<TranslatorOption>;
31
32
  constructor(option: TranslatorOption);