gc_i18n 1.4.5 → 1.4.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/.qoder/repowiki/zh/content//351/253/230/347/272/247/347/224/250/346/263/225//344/276/235/350/265/226/347/256/241/347/220/206/347/255/226/347/225/245.md +53 -32
- package/.qoder/repowiki/zh/meta/repowiki-metadata.json +1 -1
- package/lib/gc_i18n.es.js +2 -27
- package/lib/gc_i18n.umd.js +1 -1
- package/package.json +1 -1
- package/packages/index.js +4 -29
|
@@ -13,6 +13,12 @@
|
|
|
13
13
|
- [README.md](file://README.md)
|
|
14
14
|
</cite>
|
|
15
15
|
|
|
16
|
+
## 更新摘要
|
|
17
|
+
**变更内容**
|
|
18
|
+
- 修复了 Vue i18n 依赖配置问题,将其从 devDependencies 移动到 dependencies
|
|
19
|
+
- 解决了下游项目依赖解析问题
|
|
20
|
+
- 更新了依赖管理策略以反映实际的运行时依赖需求
|
|
21
|
+
|
|
16
22
|
## 目录
|
|
17
23
|
1. [简介](#简介)
|
|
18
24
|
2. [项目结构](#项目结构)
|
|
@@ -36,6 +42,8 @@ gc_i18n 是一个基于 Vue 3 和 Vite 的国际化解决方案库。该项目
|
|
|
36
42
|
- 实现了智能的远程翻译资源管理
|
|
37
43
|
- 集成了实时多语言管理功能
|
|
38
44
|
|
|
45
|
+
**更新** 修复了 Vue i18n 依赖配置问题,确保其在生产环境中正确可用
|
|
46
|
+
|
|
39
47
|
## 项目结构
|
|
40
48
|
|
|
41
49
|
项目采用清晰的模块化组织结构,主要分为以下几个核心部分:
|
|
@@ -61,13 +69,13 @@ end
|
|
|
61
69
|
```
|
|
62
70
|
|
|
63
71
|
**图表来源**
|
|
64
|
-
- [package.json](file://package.json#L1-L48)
|
|
65
|
-
- [vite.config.js](file://vite.config.js#L1-L72)
|
|
66
|
-
- [packages/index.js](file://packages/index.js#L1-L418)
|
|
72
|
+
- [package.json:1-48](file://package.json#L1-L48)
|
|
73
|
+
- [vite.config.js:1-72](file://vite.config.js#L1-L72)
|
|
74
|
+
- [packages/index.js:1-418](file://packages/index.js#L1-L418)
|
|
67
75
|
|
|
68
76
|
**章节来源**
|
|
69
|
-
- [package.json](file://package.json#L1-L48)
|
|
70
|
-
- [vite.config.js](file://vite.config.js#L1-L72)
|
|
77
|
+
- [package.json:1-48](file://package.json#L1-L48)
|
|
78
|
+
- [vite.config.js:1-72](file://vite.config.js#L1-L72)
|
|
71
79
|
|
|
72
80
|
## 核心依赖分析
|
|
73
81
|
|
|
@@ -85,17 +93,17 @@ D[lodash-es] --> D1[工具函数]
|
|
|
85
93
|
E[store2] --> E1[本地存储]
|
|
86
94
|
F[sweetalert2] --> F1[模态框]
|
|
87
95
|
G[vue-demi] --> G1[Vue兼容层]
|
|
88
|
-
end
|
|
89
|
-
subgraph "国际化相关"
|
|
90
96
|
H[vue-i18n] --> H1[Vue国际化]
|
|
97
|
+
end
|
|
98
|
+
subgraph "框架相关"
|
|
91
99
|
I[vue] --> I1[Vue框架]
|
|
92
100
|
J[vue-router] --> J1[路由集成]
|
|
93
101
|
end
|
|
94
102
|
```
|
|
95
103
|
|
|
96
104
|
**图表来源**
|
|
97
|
-
- [package.json](file://package.json#L21-
|
|
98
|
-
- [packages/index.js](file://packages/index.js#L1-L50)
|
|
105
|
+
- [package.json:21-30](file://package.json#L21-L30)
|
|
106
|
+
- [packages/index.js:1-50](file://packages/index.js#L1-L50)
|
|
99
107
|
|
|
100
108
|
### 关键依赖特性
|
|
101
109
|
|
|
@@ -105,10 +113,13 @@ end
|
|
|
105
113
|
4. **lodash-es**: ES 模块版本的工具库,支持 Tree Shaking
|
|
106
114
|
5. **store2**: 提供本地存储功能,支持命名空间隔离
|
|
107
115
|
6. **sweetalert2**: 现代化的模态框组件,用于多语言管理界面
|
|
116
|
+
7. **vue-i18n**: 国际化核心依赖,现已正确配置为生产依赖
|
|
117
|
+
|
|
118
|
+
**更新** Vue i18n 现已从 devDependencies 移动到 dependencies,确保在生产环境中正确解析和使用
|
|
108
119
|
|
|
109
120
|
**章节来源**
|
|
110
|
-
- [package.json](file://package.json#L21-
|
|
111
|
-
- [packages/index.js](file://packages/index.js#L1-L50)
|
|
121
|
+
- [package.json:21-30](file://package.json#L21-L30)
|
|
122
|
+
- [packages/index.js:1-50](file://packages/index.js#L1-L50)
|
|
112
123
|
|
|
113
124
|
## 构建系统依赖管理
|
|
114
125
|
|
|
@@ -135,7 +146,7 @@ L --> O[lang/*]
|
|
|
135
146
|
```
|
|
136
147
|
|
|
137
148
|
**图表来源**
|
|
138
|
-
- [vite.config.js](file://vite.config.js#L20-L35)
|
|
149
|
+
- [vite.config.js:20-35](file://vite.config.js#L20-L35)
|
|
139
150
|
|
|
140
151
|
### 构建输出策略
|
|
141
152
|
|
|
@@ -145,8 +156,8 @@ L --> O[lang/*]
|
|
|
145
156
|
- **CSS 提取**: 独立的样式文件输出
|
|
146
157
|
|
|
147
158
|
**章节来源**
|
|
148
|
-
- [vite.config.js](file://vite.config.js#L10-L18)
|
|
149
|
-
- [vite.config.js](file://vite.config.js#L35-L50)
|
|
159
|
+
- [vite.config.js:10-18](file://vite.config.js#L10-L18)
|
|
160
|
+
- [vite.config.js:35-50](file://vite.config.js#L35-L50)
|
|
150
161
|
|
|
151
162
|
## 运行时依赖策略
|
|
152
163
|
|
|
@@ -174,7 +185,7 @@ end
|
|
|
174
185
|
```
|
|
175
186
|
|
|
176
187
|
**图表来源**
|
|
177
|
-
- [packages/libs/service.js](file://packages/libs/service.js#L87-L131)
|
|
188
|
+
- [packages/libs/service.js:87-131](file://packages/libs/service.js#L87-L131)
|
|
178
189
|
|
|
179
190
|
### 动态模块加载
|
|
180
191
|
|
|
@@ -191,11 +202,11 @@ F --> G[应用翻译]
|
|
|
191
202
|
```
|
|
192
203
|
|
|
193
204
|
**图表来源**
|
|
194
|
-
- [packages/index.js](file://packages/index.js#L148-L239)
|
|
205
|
+
- [packages/index.js:148-239](file://packages/index.js#L148-L239)
|
|
195
206
|
|
|
196
207
|
**章节来源**
|
|
197
|
-
- [packages/libs/service.js](file://packages/libs/service.js#L87-L131)
|
|
198
|
-
- [packages/index.js](file://packages/index.js#L148-L239)
|
|
208
|
+
- [packages/libs/service.js:87-131](file://packages/libs/service.js#L87-L131)
|
|
209
|
+
- [packages/index.js:148-239](file://packages/index.js#L148-L239)
|
|
199
210
|
|
|
200
211
|
## 开发依赖管理
|
|
201
212
|
|
|
@@ -227,11 +238,11 @@ end
|
|
|
227
238
|
```
|
|
228
239
|
|
|
229
240
|
**图表来源**
|
|
230
|
-
- [package.json](file://package.json#
|
|
241
|
+
- [package.json:31-43](file://package.json#L31-L43)
|
|
231
242
|
|
|
232
243
|
**章节来源**
|
|
233
|
-
- [package.json](file://package.json#
|
|
234
|
-
- [vite.config.js](file://vite.config.js#L63-L70)
|
|
244
|
+
- [package.json:31-43](file://package.json#L31-L43)
|
|
245
|
+
- [vite.config.js:63-70](file://vite.config.js#L63-L70)
|
|
235
246
|
|
|
236
247
|
## 依赖版本控制策略
|
|
237
248
|
|
|
@@ -254,7 +265,7 @@ H --> K[用于关键依赖]
|
|
|
254
265
|
```
|
|
255
266
|
|
|
256
267
|
**图表来源**
|
|
257
|
-
- [package.json](file://package.json#L21-L47)
|
|
268
|
+
- [package.json:21-47](file://package.json#L21-L47)
|
|
258
269
|
|
|
259
270
|
### 锁定文件管理
|
|
260
271
|
|
|
@@ -265,8 +276,8 @@ H --> K[用于关键依赖]
|
|
|
265
276
|
- **自动安装**: pnpm 自动处理 peer dependencies
|
|
266
277
|
|
|
267
278
|
**章节来源**
|
|
268
|
-
- [pnpm-lock.yaml](file://pnpm-lock.yaml#L1-L69)
|
|
269
|
-
- [package.json](file://package.json#L44-L47)
|
|
279
|
+
- [pnpm-lock.yaml:1-69](file://pnpm-lock.yaml#L1-L69)
|
|
280
|
+
- [package.json:44-47](file://package.json#L44-L47)
|
|
270
281
|
|
|
271
282
|
## 模块解析策略
|
|
272
283
|
|
|
@@ -292,8 +303,8 @@ end
|
|
|
292
303
|
```
|
|
293
304
|
|
|
294
305
|
**图表来源**
|
|
295
|
-
- [package.json](file://package.json#L7-L12)
|
|
296
|
-
- [package.json](file://package.json#L5-L11)
|
|
306
|
+
- [package.json:7-12](file://package.json#L7-L12)
|
|
307
|
+
- [package.json:5-11](file://package.json#L5-L11)
|
|
297
308
|
|
|
298
309
|
### 兼容性保证
|
|
299
310
|
|
|
@@ -304,8 +315,8 @@ end
|
|
|
304
315
|
3. **API 兼容**: 统一的国际化 API 接口
|
|
305
316
|
|
|
306
317
|
**章节来源**
|
|
307
|
-
- [package.json](file://package.json#L5-L12)
|
|
308
|
-
- [packages/index.js](file://packages/index.js#L7-L41)
|
|
318
|
+
- [package.json:5-12](file://package.json#L5-L12)
|
|
319
|
+
- [packages/index.js:7-41](file://packages/index.js#L7-L41)
|
|
309
320
|
|
|
310
321
|
## 性能优化考虑
|
|
311
322
|
|
|
@@ -324,7 +335,7 @@ I --> J[避免全局污染]
|
|
|
324
335
|
```
|
|
325
336
|
|
|
326
337
|
**图表来源**
|
|
327
|
-
- [packages/index.js](file://packages/index.js#L1-L50)
|
|
338
|
+
- [packages/index.js:1-50](file://packages/index.js#L1-L50)
|
|
328
339
|
|
|
329
340
|
### 运行时优化
|
|
330
341
|
|
|
@@ -333,8 +344,8 @@ I --> J[避免全局污染]
|
|
|
333
344
|
3. **增量更新**: 支持翻译数据的增量同步
|
|
334
345
|
|
|
335
346
|
**章节来源**
|
|
336
|
-
- [packages/libs/service.js](file://packages/libs/service.js#L95-L131)
|
|
337
|
-
- [packages/index.js](file://packages/index.js#L329-L372)
|
|
347
|
+
- [packages/libs/service.js:95-131](file://packages/libs/service.js#L95-L131)
|
|
348
|
+
- [packages/index.js:329-372](file://packages/index.js#L329-L372)
|
|
338
349
|
|
|
339
350
|
## 故障排除指南
|
|
340
351
|
|
|
@@ -347,6 +358,14 @@ I --> J[避免全局污染]
|
|
|
347
358
|
| 构建失败 | 编译错误或打包问题 | 检查 Vite 配置和外部化设置 |
|
|
348
359
|
| 性能问题 | 加载缓慢或内存占用高 | 分析 bundle 大小和优化导入 |
|
|
349
360
|
|
|
361
|
+
### 依赖配置问题
|
|
362
|
+
|
|
363
|
+
**更新** Vue i18n 依赖配置问题已修复:
|
|
364
|
+
- 问题:vue-i18n 曾被错误地放置在 devDependencies 中
|
|
365
|
+
- 影响:下游项目无法正确解析 vue-i18n 依赖
|
|
366
|
+
- 解决:已将其移动到 dependencies 中
|
|
367
|
+
- 验证:现在可以在生产环境中正确使用
|
|
368
|
+
|
|
350
369
|
### 调试工具
|
|
351
370
|
|
|
352
371
|
1. **依赖图分析**: 使用 `npm ls` 或 `pnpm ls` 查看依赖关系
|
|
@@ -354,7 +373,7 @@ I --> J[避免全局污染]
|
|
|
354
373
|
3. **运行时监控**: 检查浏览器开发者工具中的网络请求
|
|
355
374
|
|
|
356
375
|
**章节来源**
|
|
357
|
-
- [README.md](file://README.md#L21-L51)
|
|
376
|
+
- [README.md:21-51](file://README.md#L21-L51)
|
|
358
377
|
|
|
359
378
|
## 总结
|
|
360
379
|
|
|
@@ -374,4 +393,6 @@ gc_i18n 的依赖管理策略体现了现代前端工程的最佳实践:
|
|
|
374
393
|
3. **构建优化**: 外部化和代码分割策略
|
|
375
394
|
4. **测试覆盖**: 完善的单元测试和集成测试
|
|
376
395
|
|
|
396
|
+
**更新** 通过修复 Vue i18n 依赖配置问题,确保了库在各种环境下的可靠性和兼容性,解决了下游项目可能遇到的依赖解析问题。
|
|
397
|
+
|
|
377
398
|
该依赖管理策略为大型国际化项目的可维护性和扩展性提供了坚实的基础,是现代前端库开发的优秀范例。
|