gc_i18n 1.3.0 → 1.3.2

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
@@ -1,5 +1,63 @@
1
- # Vue 3 + Vite
1
+ # gc_i18n
2
2
 
3
- This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
3
+ 一个基于 Vue 3 Vite 的国际化解决方案库。
4
4
 
5
- Learn more about IDE Support for Vue in the [Vue Docs Scaling up Guide](https://vuejs.org/guide/scaling-up/tooling.html#ide-support).
5
+ ## 安装
6
+
7
+ ```bash
8
+ npm install gc_i18n
9
+ ```
10
+
11
+ ## 使用
12
+
13
+ ```javascript
14
+ import lang from 'gc_i18n';
15
+
16
+ const app = createApp(App);
17
+ app.use(lang, router);
18
+ app.mount('#app');
19
+ ```
20
+
21
+ ## Node.js 版本兼容性说明
22
+
23
+ 本库支持 Node.js 16.0.0 及以上版本。在低版本 Node.js 环境中使用时,请注意以下几点:
24
+
25
+ 1. 本库同时提供 ESM 和 UMD 两种模块格式的构建产物
26
+ 2. 在 package.json 中明确指定了 `exports` 字段以提高模块解析兼容性
27
+ 3. 如果在 Node.js 16.0.0 环境中遇到模块解析错误,请尝试以下解决方案:
28
+
29
+ ### 解决方案 1:升级 Node.js 版本(推荐)
30
+ 建议将 Node.js 升级到 18.x 或更高版本以获得更好的 ES 模块支持。
31
+
32
+ ### 解决方案 2:使用 require 方式导入
33
+ 如果必须使用 Node.js 16.0.0,可以尝试使用 CommonJS 方式导入:
34
+
35
+ ```javascript
36
+ const lang = require('gc_i18n');
37
+ ```
38
+
39
+ ### 解决方案 3:检查 Vite 配置
40
+ 确保你的 Vite 配置正确处理了模块解析:
41
+
42
+ ```javascript
43
+ // vite.config.js
44
+ export default defineConfig({
45
+ resolve: {
46
+ alias: {
47
+ 'gc_i18n': 'gc_i18n/lib/gc_i18n.umd.cjs'
48
+ }
49
+ }
50
+ });
51
+ ```
52
+
53
+ ## 构建
54
+
55
+ ```bash
56
+ npm run build
57
+ ```
58
+
59
+ ## 开发
60
+
61
+ ```bash
62
+ npm run dev
63
+ ```
package/lang/index.js CHANGED
@@ -27,7 +27,7 @@ export default {
27
27
  appCode: "TEST",
28
28
  router,
29
29
  orgCode: import.meta.env.MODE === "unit" ? "DD" : "GREENCLOUD",
30
- local: localStorage.getItem("I18N_LANGUAGE"),
30
+ // locale: localStorage.getItem("I18N_LANGUAGE"),
31
31
  // loginRouteName: "Login",
32
32
  dev: true,
33
33
  login: false,