@das-fed/upf-utils 6.4.0-dev.165 → 6.4.0-dev.167

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.
@@ -1,4 +1,4 @@
1
- const E = (n) => n === null || typeof n > "u" || n === "", f = [
1
+ const E = (e) => e === null || typeof e > "u" || e === "", u = [
2
2
  "zh-CN",
3
3
  "zh-TW",
4
4
  "zh-HK",
@@ -15,7 +15,7 @@ const E = (n) => n === null || typeof n > "u" || n === "", f = [
15
15
  "nl-NL",
16
16
  "vi-VN",
17
17
  "tr-TR"
18
- ], d = {
18
+ ], l = {
19
19
  3: "zh-HK",
20
20
  4: "zh-TW",
21
21
  6: "ru-RU",
@@ -29,42 +29,68 @@ const E = (n) => n === null || typeof n > "u" || n === "", f = [
29
29
  14: "nl-NL",
30
30
  15: "vi-VN",
31
31
  16: "tr-TR"
32
- }, h = (n) => {
33
- const r = [...n, ...Object.values(d).filter((t) => n.includes(t))];
34
- return f.filter((t) => r.includes(t) || Object.entries(d).some(
35
- ([s, a]) => n.includes(s) && t === a || n.includes(a) && t === a
32
+ }, h = (e) => {
33
+ const c = [...e, ...Object.values(l).filter((n) => e.includes(n))];
34
+ return u.filter((n) => c.includes(n) || Object.entries(l).some(
35
+ ([t, a]) => e.includes(t) && n === a || e.includes(a) && n === a
36
36
  ));
37
- }, U = ["zh-CN", "zh-MO", "en-US", "10"], b = async (n) => {
37
+ }, p = ["zh-CN", "zh-MO", "en-US", "10"], y = async (e) => {
38
+ const c = e || {};
39
+ let {
40
+ currentLang: n = "zh-CN",
41
+ baseUrl: t = "/",
42
+ appName: a = "jc",
43
+ isPullBack: o = !1,
44
+ isDasUI: U = !1,
45
+ urlObj: r = { frontEndUrl: "", backEndUrl: "", dasUiUrl: "" }
46
+ } = c;
47
+ (typeof n != "string" || !n) && (n = "zh-CN"), (typeof a != "string" || !a) && (a = "jc"), typeof t != "string" && (t = "/"), t || (t = "/"), t.endsWith("/") || (t = t + "/");
48
+ const i = {
49
+ frontEnd: null,
50
+ dasUiEnd: null,
51
+ backMsg: null
52
+ };
53
+ let f = !1;
38
54
  try {
39
- let { currentLang: r = "zh-CN", baseUrl: t = "/", appName: s = "base", isPullBack: a = !1, urlObj: e = { frontEndUrl: "", backEndUrl: "" } } = n || {}, l = {
40
- frontEnd: null,
41
- backMsg: null
42
- }, o = (e == null ? void 0 : e.frontEndUrl) || `${t}web-front-end/i18n/${s}_${r}.js`, c = (e == null ? void 0 : e.backEndUrl) || `${t}web-back-end/i18n/${s}_${r}.js`;
43
- const i = await import(
55
+ const s = await import(
44
56
  /* @vite-ignore */
45
- `${o}`
57
+ `${(r == null ? void 0 : r.frontEndUrl) || `${t}web-front-end/i18n/${a}_${n}.js`}`
46
58
  );
47
- if (l.frontEnd = i.default || null, a || e != null && e.backEndUrl) {
48
- const u = await import(
59
+ i.frontEnd = (s == null ? void 0 : s.default) ?? null, i.frontEnd && (f = !0);
60
+ } catch {
61
+ }
62
+ if (o || r != null && r.backEndUrl)
63
+ try {
64
+ const s = await import(
49
65
  /* @vite-ignore */
50
- `${c}`
66
+ `${(r == null ? void 0 : r.backEndUrl) || `${t}web-back-end/i18n/${a}_${n}.js`}`
51
67
  );
52
- l.backMsg = u.default || null;
68
+ i.backMsg = (s == null ? void 0 : s.default) ?? null, i.backMsg && (f = !0);
69
+ } catch {
53
70
  }
54
- return l;
55
- } catch {
56
- }
57
- }, p = async (n = "front-end") => {
58
- let r = {}, s = await import(
71
+ if (U)
72
+ try {
73
+ const s = await import(
74
+ /* @vite-ignore */
75
+ `${(r == null ? void 0 : r.dasUiUrl) || `${t}web-front-end/i18n/dasui_${n}.js`}`
76
+ );
77
+ i.dasUiEnd = (s == null ? void 0 : s.default) ?? null, i.dasUiEnd && (f = !0);
78
+ } catch {
79
+ }
80
+ if (!f)
81
+ throw new Error("语言包加载失败");
82
+ return i;
83
+ }, $ = async (e = "front-end") => {
84
+ let c = {}, t = await import(
59
85
  /* @vite-ignore */
60
- `/i18n/${n}/global.js`
86
+ `/i18n/${e}/global.js`
61
87
  );
62
- return r = (s == null ? void 0 : s.default) || {}, r;
88
+ return c = (t == null ? void 0 : t.default) || {}, c;
63
89
  };
64
90
  export {
65
- U as getCurrentSysLang,
91
+ p as getCurrentSysLang,
66
92
  h as getSysLangArr,
67
- p as handleGlobalI18n,
68
- b as handleI18nData,
93
+ $ as handleGlobalI18n,
94
+ y as handleI18nData,
69
95
  E as isEmpty
70
96
  };