vite-plugin-ai-i18n 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Your Name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # vite-plugin-ai-i18n
2
+
3
+ AI-powered internationalization plugin for Vite. Automatically scan, translate and manage i18n files.
4
+
5
+ ## ✨ Features
6
+
7
+ - πŸ” **Auto Scan** - Automatically scan Chinese text in your code
8
+ - πŸ€– **AI Translation** - Use OpenAI to translate to multiple languages
9
+ - πŸ“¦ **Auto Generate** - Generate language files automatically
10
+ - πŸ”„ **Hot Reload** - Support Vite HMR
11
+ - 🎯 **Smart Detection** - Filter out code, comments, and system messages
12
+
13
+ ## πŸ“¦ Installation
14
+
15
+ ::: code-group
16
+
17
+ ```bash [npm]
18
+ npm install -D vite-plugin-ai-i18n
19
+ ```
20
+
21
+ ```bash [yarn]
22
+ yarn add -D vite-plugin-ai-i18n
23
+ ```
24
+
25
+ ```bash [pnpm]
26
+ pnpm add -D vite-plugin-ai-i18n
27
+ ```
28
+
29
+ :::
30
+
31
+ ## πŸš€ Quick Start
32
+
33
+ ```typescript
34
+ // vite.config.ts
35
+ import { defineConfig } from "vite";
36
+ import { vitePluginAII18n } from "vite-plugin-ai-i18n";
37
+
38
+ export default defineConfig({
39
+ plugins: [
40
+ vitePluginAII18n({
41
+ apiKey: process.env.OPENAI_API_KEY,
42
+ localesDir: "src/locales",
43
+ defaultLocale: "zh-CN",
44
+ targetLocales: ["en-US"],
45
+ autoScan: true,
46
+ autoTranslate: true,
47
+ }),
48
+ ],
49
+ });
50
+ ```
51
+
52
+ ## πŸ“š Documentation
53
+
54
+ Full documentation: https://mo520.github.io/vite-plugin-ai/plugins/ai-i18n
55
+
56
+ ## πŸ“„ License
57
+
58
+ MIT
@@ -0,0 +1,26 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ /**
4
+ * AI ε›½ι™…εŒ–εŠ©ζ‰‹ζ’δ»Άε…₯口
5
+ *
6
+ * εŠŸθƒ½οΌš
7
+ * - ζ‰«ζζΊη δΈ­ηš„δΈ­ζ–‡ζ–‡ζœ¬
8
+ * - 使用 AI θ‡ͺεŠ¨ηΏ»θ―‘
9
+ * - η”Ÿζˆ/ζ›΄ζ–° i18n 语言文仢
10
+ */
11
+
12
+ interface I18nPluginOptions {
13
+ apiKey?: string;
14
+ apiUrl?: string;
15
+ model?: string;
16
+ include?: string[];
17
+ exclude?: string[];
18
+ localesDir?: string;
19
+ defaultLocale?: string;
20
+ targetLocales?: string[];
21
+ autoScan?: boolean;
22
+ autoTranslate?: boolean;
23
+ }
24
+ declare function vitePluginAII18n(options?: I18nPluginOptions): Plugin;
25
+
26
+ export { type I18nPluginOptions, vitePluginAII18n };
@@ -0,0 +1,26 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ /**
4
+ * AI ε›½ι™…εŒ–εŠ©ζ‰‹ζ’δ»Άε…₯口
5
+ *
6
+ * εŠŸθƒ½οΌš
7
+ * - ζ‰«ζζΊη δΈ­ηš„δΈ­ζ–‡ζ–‡ζœ¬
8
+ * - 使用 AI θ‡ͺεŠ¨ηΏ»θ―‘
9
+ * - η”Ÿζˆ/ζ›΄ζ–° i18n 语言文仢
10
+ */
11
+
12
+ interface I18nPluginOptions {
13
+ apiKey?: string;
14
+ apiUrl?: string;
15
+ model?: string;
16
+ include?: string[];
17
+ exclude?: string[];
18
+ localesDir?: string;
19
+ defaultLocale?: string;
20
+ targetLocales?: string[];
21
+ autoScan?: boolean;
22
+ autoTranslate?: boolean;
23
+ }
24
+ declare function vitePluginAII18n(options?: I18nPluginOptions): Plugin;
25
+
26
+ export { type I18nPluginOptions, vitePluginAII18n };