@fe-free/core 6.0.18 → 6.0.20

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @fe-free/core
2
2
 
3
+ ## 6.0.20
4
+
5
+ ### Patch Changes
6
+
7
+ - @fe-free/icons@6.0.20
8
+ - @fe-free/tool@6.0.20
9
+
10
+ ## 6.0.19
11
+
12
+ ### Patch Changes
13
+
14
+ - i18n
15
+ - @fe-free/icons@6.0.19
16
+ - @fe-free/tool@6.0.19
17
+
3
18
  ## 6.0.18
4
19
 
5
20
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fe-free/core",
3
- "version": "6.0.18",
3
+ "version": "6.0.20",
4
4
  "description": "React 业务核心组件库:CRUD、ProForm 扩展、布局、路由、树、上传等(Antd + ProComponents)",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -43,8 +43,8 @@
43
43
  "i18next-icu": "^2.4.1",
44
44
  "react": "^19.2.0",
45
45
  "react-i18next": "^16.4.0",
46
- "@fe-free/icons": "6.0.18",
47
- "@fe-free/tool": "6.0.18"
46
+ "@fe-free/icons": "6.0.20",
47
+ "@fe-free/tool": "6.0.20"
48
48
  },
49
49
  "scripts": {
50
50
  "i18n-extract": "rm -rf ./src/locales/zh-CN && npx i18next-cli extract"
package/src/i18n.tsx CHANGED
@@ -49,35 +49,38 @@ function getDefaultLng() {
49
49
  }
50
50
 
51
51
  function initI18n(
52
- resources: {
53
- enTranslation?: Record<string, unknown>;
52
+ params: {
53
+ lng?: EnumLanguage;
54
+ enUSTranslation?: Record<string, unknown>;
54
55
  zhHKTranslation?: Record<string, unknown>;
56
+ // 历史原因,保留
57
+ enTranslation?: Record<string, unknown>;
55
58
  } = {},
56
59
  ) {
57
- const lng = getDefaultLng();
58
- const allResources = {
60
+ const lng = params.lng || getDefaultLng();
61
+ const resources = {
59
62
  [EnumLanguage.ZH_CN]: {
60
63
  translation: {},
61
64
  },
62
65
  [EnumLanguage.ZH_HK]: {
63
- translation: { ...zhHKTranslation, ...resources.zhHKTranslation },
66
+ translation: { ...zhHKTranslation, ...params.zhHKTranslation },
64
67
  },
65
68
  [EnumLanguage.EN_US]: {
66
- translation: { ...enUSTranslation, ...resources.enTranslation },
69
+ translation: { ...enUSTranslation, ...params.enUSTranslation, ...params.enTranslation },
67
70
  },
68
71
  };
69
72
 
70
- console.log('initI18n', lng, allResources);
73
+ console.log('initI18n', lng, resources);
71
74
 
72
75
  // @ts-ignore
73
- window._i18nResources = allResources;
76
+ window._i18nResources = resources;
74
77
 
75
78
  void i18n
76
79
  .use(LanguageDetector)
77
80
  .use(initReactI18next)
78
81
  .use(ICU)
79
82
  .init({
80
- resources: allResources,
83
+ resources,
81
84
  lng,
82
85
  fallbackLng: EnumLanguage.ZH_CN,
83
86
  interpolation: {