i18n-a11y 1.0.5 → 1.0.6
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 +69 -0
- package/dist/src/utils/genI18nConfig.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# auto-i18n
|
|
2
|
+
|
|
3
|
+
## description
|
|
4
|
+
|
|
5
|
+
node cli tools for auto generate i18n files
|
|
6
|
+
|
|
7
|
+
## install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm i i18n-a11y -D
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## usage
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
"scripts": {
|
|
17
|
+
"i18n": "i18n-a11y scan"
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## configuration
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
entryDirs: ["src/views", "src/components"], // scan entry directory
|
|
26
|
+
extensions: ["vue"], // scan file extensions
|
|
27
|
+
output: "ts", // output file type
|
|
28
|
+
outputDir: "src/i18n/locales", // output file directory
|
|
29
|
+
withFileComment: false, // add file comment on file top
|
|
30
|
+
withKeyFileComment: false, // add key file comment on key top
|
|
31
|
+
i18nFns: ["t", "$t"], // i18n function name
|
|
32
|
+
supportChineseKey: true, // support chinese key
|
|
33
|
+
languages: ["zh-CN", "en-US"], // languages
|
|
34
|
+
};
|
|
35
|
+
```
|
|
36
|
+
## Environment Variables
|
|
37
|
+
|
|
38
|
+
Create a `.env.local` file in the project root and add:
|
|
39
|
+
``` bash
|
|
40
|
+
DEEPSEEK_API_KEY=your-deepseek-key-here
|
|
41
|
+
DEEPSEEK_API_URL=https://api.deepseek.com
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Output
|
|
45
|
+
|
|
46
|
+
After running the CLI, files will be generated in the outputDir, for example `src/i18n/locales`
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
src/i18n/locale/
|
|
50
|
+
├─ zh-CN.ts
|
|
51
|
+
├─ en-US.ts
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Features
|
|
56
|
+
|
|
57
|
+
Automatically scans project files to extract translation keys
|
|
58
|
+
|
|
59
|
+
Supports Vue, JS, and TS files
|
|
60
|
+
|
|
61
|
+
Generates multilingual locale files
|
|
62
|
+
|
|
63
|
+
Optional file-level and key-level comments
|
|
64
|
+
|
|
65
|
+
Fully configurable
|
|
66
|
+
|
|
67
|
+
Supports Chinese keys
|
|
68
|
+
|
|
69
|
+
Integrates Deepseek AI for automatic translations
|
|
@@ -43,7 +43,7 @@ export const genI18nConfig = async () => {
|
|
|
43
43
|
type: "input",
|
|
44
44
|
name: "outputDir",
|
|
45
45
|
message: chalk.green("Step 4: Enter output language directory"),
|
|
46
|
-
default: "src/i18n/
|
|
46
|
+
default: "src/i18n/locales",
|
|
47
47
|
},
|
|
48
48
|
]);
|
|
49
49
|
// Step 5: file header comment
|