gc_i18n 1.6.9 → 1.7.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/lib/gc_i18n.es.js +106 -106
- package/lib/gc_i18n.umd.js +8 -8
- package/package.json +1 -1
- package/packages/index.js +4 -4
package/lib/gc_i18n.es.js
CHANGED
|
@@ -3,7 +3,7 @@ import xt from "keyboardjs";
|
|
|
3
3
|
import { h as xe, ref as ie, computed as He, onMounted as to, nextTick as _t, Vue as _e } from "vue-demi";
|
|
4
4
|
import st from "axios";
|
|
5
5
|
import E from "store2";
|
|
6
|
-
import
|
|
6
|
+
import b from "lodash-es";
|
|
7
7
|
import { jws as no } from "jsrsasign";
|
|
8
8
|
const oo = [
|
|
9
9
|
"ar-SA",
|
|
@@ -24,9 +24,9 @@ const oo = [
|
|
|
24
24
|
return e;
|
|
25
25
|
}, io = (t, e, n) => (e.forEach((o) => {
|
|
26
26
|
const s = o.key.split(".");
|
|
27
|
-
s[0] === "common" &&
|
|
28
|
-
const i =
|
|
29
|
-
i ?
|
|
27
|
+
s[0] === "common" && b.find(t, { key: `${n}.${s[1]}` }) && b.remove(t, { key: `${n}.${s[1]}` });
|
|
28
|
+
const i = b.find(t, { key: o.key });
|
|
29
|
+
i ? b.merge(i, o) : t.push(o);
|
|
30
30
|
}), t), ce = st.create({
|
|
31
31
|
timeout: 8e3
|
|
32
32
|
}), Ae = /* @__PURE__ */ new Map(), ro = "https://extendapi.ihotel.cn", ao = "https://test.ihotel.cn", lo = /^https?:\/\//i, Je = (t) => String(t || "guest").replace(/[^\w-]/g, "_"), we = async (t, e) => typeof e != "function" ? t : await e(t) || t, Kt = ({ env: t, dev: e } = {}) => {
|
|
@@ -55,7 +55,7 @@ const oo = [
|
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
if (l.data && l.data.result === 0) {
|
|
58
|
-
const a =
|
|
58
|
+
const a = b.get(l.data, "retVal", []), d = a.map((u) => ({
|
|
59
59
|
langCode: u.language || u.langCode || u,
|
|
60
60
|
langName: u.langName || u.language || u
|
|
61
61
|
}));
|
|
@@ -122,7 +122,7 @@ const oo = [
|
|
|
122
122
|
const e = t.trim();
|
|
123
123
|
return !e || /^<!doctype/i.test(e) || /^<html/i.test(e) ? (console.warn("i18n_token 接口未返回有效 token,请检查业务项目接口"), "") : e;
|
|
124
124
|
}
|
|
125
|
-
return
|
|
125
|
+
return b.get(t, "retVal.i18n_token") || b.get(t, "retVal.token") || b.get(t, "i18n_token") || b.get(t, "token") || "";
|
|
126
126
|
}, co = async ({
|
|
127
127
|
request: t,
|
|
128
128
|
appCode: e,
|
|
@@ -165,7 +165,7 @@ const oo = [
|
|
|
165
165
|
getRequestToken: r
|
|
166
166
|
}) => {
|
|
167
167
|
try {
|
|
168
|
-
const l = Je(i), a = `I18N_${
|
|
168
|
+
const l = Je(i), a = `I18N_${b.toUpper(e)}_${l}`, d = E.namespace(a), u = {
|
|
169
169
|
baseUrl: t,
|
|
170
170
|
appCode: e,
|
|
171
171
|
language: n,
|
|
@@ -177,25 +177,25 @@ const oo = [
|
|
|
177
177
|
n || "",
|
|
178
178
|
l,
|
|
179
179
|
o || "",
|
|
180
|
-
|
|
180
|
+
b.get(h, "lastPullDate", "")
|
|
181
181
|
].join("|");
|
|
182
182
|
if (Ae.has(f))
|
|
183
183
|
return Ae.get(f);
|
|
184
184
|
const x = (async () => {
|
|
185
185
|
if (!h || !h.lastPullDate) {
|
|
186
186
|
const _ = await Et(u);
|
|
187
|
-
return _ ? (d.set(n, _),
|
|
187
|
+
return _ ? (d.set(n, _), b.get(_, "translatesDTOs", [])) : b.get(h, "translatesDTOs", []);
|
|
188
188
|
}
|
|
189
|
-
const { lastPullDate:
|
|
189
|
+
const { lastPullDate: L } = h, S = await Et({
|
|
190
190
|
...u,
|
|
191
|
-
lastPullDate:
|
|
191
|
+
lastPullDate: L
|
|
192
192
|
});
|
|
193
|
-
if (!
|
|
194
|
-
return
|
|
195
|
-
const I =
|
|
196
|
-
if (!
|
|
197
|
-
const _ = io(I,
|
|
198
|
-
lastPullDate:
|
|
193
|
+
if (!S)
|
|
194
|
+
return b.get(h, "translatesDTOs", []);
|
|
195
|
+
const I = b.get(h, "translatesDTOs", []);
|
|
196
|
+
if (!b.isEmpty(S.translatesDTOs)) {
|
|
197
|
+
const _ = io(I, S.translatesDTOs, s), w = {
|
|
198
|
+
lastPullDate: S.lastPullDate,
|
|
199
199
|
translatesDTOs: _
|
|
200
200
|
};
|
|
201
201
|
return d.set(n, w, ":"), _;
|
|
@@ -207,16 +207,16 @@ const oo = [
|
|
|
207
207
|
}), x;
|
|
208
208
|
} catch (l) {
|
|
209
209
|
console.error("处理翻译数据失败:", l);
|
|
210
|
-
const a = Je(i), d = E.namespace(`I18N_${
|
|
211
|
-
return
|
|
210
|
+
const a = Je(i), d = E.namespace(`I18N_${b.toUpper(e)}_${a}`);
|
|
211
|
+
return b.get(d.get(n), "translatesDTOs", []);
|
|
212
212
|
}
|
|
213
213
|
}, Tt = ({ appCode: t, cacheScope: e } = {}) => {
|
|
214
214
|
if (t) {
|
|
215
215
|
if (e) {
|
|
216
|
-
E.namespace(`I18N_${
|
|
216
|
+
E.namespace(`I18N_${b.toUpper(t)}_${Je(e)}`).clearAll();
|
|
217
217
|
return;
|
|
218
218
|
}
|
|
219
|
-
E.namespace(`I18N_${
|
|
219
|
+
E.namespace(`I18N_${b.toUpper(t)}`).clearAll();
|
|
220
220
|
}
|
|
221
221
|
};
|
|
222
222
|
function St(t) {
|
|
@@ -314,7 +314,7 @@ function Xt(t) {
|
|
|
314
314
|
}), n.length ? n : [{ type: "text", value: t }];
|
|
315
315
|
}
|
|
316
316
|
function $t(t) {
|
|
317
|
-
return
|
|
317
|
+
return b.reduce(
|
|
318
318
|
t,
|
|
319
319
|
(e, n) => {
|
|
320
320
|
const o = e[e.length - 1];
|
|
@@ -397,11 +397,11 @@ class mo {
|
|
|
397
397
|
baseUrl: this.baseUrl,
|
|
398
398
|
appCode: this.appCode
|
|
399
399
|
}), o = Fe(n);
|
|
400
|
-
o && o.result === 0 ? (
|
|
400
|
+
o && o.result === 0 ? (b.isEmpty(e) && (e = ["zh-CN", "en-US", "zh-TW"]), this.languages = b.map(o.retVal || [], (s) => {
|
|
401
401
|
const i = go(s);
|
|
402
402
|
return {
|
|
403
403
|
...i,
|
|
404
|
-
checked:
|
|
404
|
+
checked: b.includes(e, i.langCode)
|
|
405
405
|
};
|
|
406
406
|
}), await this.getPageData()) : (this.loading = !1, this.showError("获取语言失败,出错了"), this.render());
|
|
407
407
|
} catch (e) {
|
|
@@ -409,8 +409,8 @@ class mo {
|
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
411
|
saveLanguageSetting() {
|
|
412
|
-
const e =
|
|
413
|
-
|
|
412
|
+
const e = b.map(
|
|
413
|
+
b.filter(this.languages, (n) => n.checked),
|
|
414
414
|
"langCode"
|
|
415
415
|
);
|
|
416
416
|
E.set("I18N_LANGUAGE_SETTING", e);
|
|
@@ -428,7 +428,7 @@ class mo {
|
|
|
428
428
|
});
|
|
429
429
|
}
|
|
430
430
|
updateTranslationValue(e, n, o) {
|
|
431
|
-
const { dictKey: s } = e, i =
|
|
431
|
+
const { dictKey: s } = e, i = b.findIndex(this.mySaveData, {
|
|
432
432
|
dictKey: s
|
|
433
433
|
});
|
|
434
434
|
e[n] = o, e[`${n}_fromAi`] = "F", i > -1 ? (this.mySaveData[i][n] = o, this.mySaveData[i][`${n}_fromAi`] = "F", this.mySaveData[i].changedLangs = {
|
|
@@ -443,11 +443,11 @@ class mo {
|
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
445
|
isProtectedValue(e) {
|
|
446
|
-
return
|
|
446
|
+
return b.some(St(e), { type: "locked" });
|
|
447
447
|
}
|
|
448
448
|
isProtectedEditor() {
|
|
449
449
|
var e;
|
|
450
|
-
return
|
|
450
|
+
return b.some(((e = this.editor) == null ? void 0 : e.parts) || [], { type: "locked" });
|
|
451
451
|
}
|
|
452
452
|
openEditor(e, n) {
|
|
453
453
|
const o = this.data[e];
|
|
@@ -466,13 +466,13 @@ class mo {
|
|
|
466
466
|
const e = (n = this.root) == null ? void 0 : n.querySelector(
|
|
467
467
|
".gc_i18n_config_protected_editor"
|
|
468
468
|
);
|
|
469
|
-
!e || !this.editor ||
|
|
469
|
+
!e || !this.editor || b.forEach(e.querySelectorAll("[data-editor-index]"), (o) => {
|
|
470
470
|
const s = Number(o.dataset.editorIndex), i = this.editor.parts[s];
|
|
471
471
|
i && i.type === "text" && (i.value = o.innerText);
|
|
472
472
|
});
|
|
473
473
|
}
|
|
474
474
|
getEditorSubmitValue() {
|
|
475
|
-
return this.editor ? this.isProtectedEditor() ? (this.syncEditorPartsFromDom(),
|
|
475
|
+
return this.editor ? this.isProtectedEditor() ? (this.syncEditorPartsFromDom(), b.map(this.editor.parts, "value").join("")) : this.editor.value : "";
|
|
476
476
|
}
|
|
477
477
|
confirmEditor() {
|
|
478
478
|
if (!this.editor)
|
|
@@ -485,8 +485,8 @@ class mo {
|
|
|
485
485
|
}
|
|
486
486
|
getSubmitData() {
|
|
487
487
|
const e = [];
|
|
488
|
-
return
|
|
489
|
-
|
|
488
|
+
return b.map(this.mySaveData, (n) => {
|
|
489
|
+
b.map(b.keys(n.changedLangs || {}), (o) => {
|
|
490
490
|
e.push({
|
|
491
491
|
key: n.dictKey,
|
|
492
492
|
page: n.page,
|
|
@@ -499,7 +499,7 @@ class mo {
|
|
|
499
499
|
}
|
|
500
500
|
async saveData({ msg: e = "保存成功" } = {}, n = !0) {
|
|
501
501
|
const o = this.getSubmitData();
|
|
502
|
-
if (
|
|
502
|
+
if (b.isEmpty(o)) {
|
|
503
503
|
this.showError("没有需要保存的数据");
|
|
504
504
|
return;
|
|
505
505
|
}
|
|
@@ -536,7 +536,7 @@ class mo {
|
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
async saveNoEqual() {
|
|
539
|
-
|
|
539
|
+
b.isEmpty(this.mySaveData) || await this.saveData({ msg: "已为您自动保存" }, !1);
|
|
540
540
|
}
|
|
541
541
|
async changePage(e) {
|
|
542
542
|
await this.saveNoEqual();
|
|
@@ -571,7 +571,7 @@ class mo {
|
|
|
571
571
|
data: {
|
|
572
572
|
appCode: this.appCode,
|
|
573
573
|
searchBlur: this.searchText,
|
|
574
|
-
commaSeparatedLangs:
|
|
574
|
+
commaSeparatedLangs: b.map(this.languages, "langCode").toString(),
|
|
575
575
|
page: n === "loginData" ? this.loginRouteName : n === "pageData" ? this.name : "common",
|
|
576
576
|
pageSize: 10,
|
|
577
577
|
...e
|
|
@@ -581,7 +581,7 @@ class mo {
|
|
|
581
581
|
}), s = Fe(o);
|
|
582
582
|
if (s && s.result === 0) {
|
|
583
583
|
const i = s.retVal || {};
|
|
584
|
-
this.data =
|
|
584
|
+
this.data = b.cloneDeep(i.datas || []), this.page = {
|
|
585
585
|
firstResult: i.firstResult || 0,
|
|
586
586
|
pageSize: i.pageSize || 10,
|
|
587
587
|
totalRows: i.totalRows || 0
|
|
@@ -643,7 +643,7 @@ class mo {
|
|
|
643
643
|
return Math.max(1, Math.ceil((this.page.totalRows || 0) / this.page.pageSize));
|
|
644
644
|
}
|
|
645
645
|
get checkedLanguages() {
|
|
646
|
-
return
|
|
646
|
+
return b.filter(this.languages, (e) => e.checked);
|
|
647
647
|
}
|
|
648
648
|
renderStatus() {
|
|
649
649
|
var n;
|
|
@@ -741,7 +741,7 @@ class mo {
|
|
|
741
741
|
return '<div class="gc_i18n_config_loading">加载中...</div>';
|
|
742
742
|
}
|
|
743
743
|
renderTable() {
|
|
744
|
-
return
|
|
744
|
+
return b.isEmpty(this.data) ? `
|
|
745
745
|
<div class="gc_i18n_config_table_wrap">
|
|
746
746
|
<div class="gc_i18n_config_empty">暂无数据</div>
|
|
747
747
|
</div>
|
|
@@ -2715,7 +2715,7 @@ class lr {
|
|
|
2715
2715
|
getRequestToken: this.getRequestToken
|
|
2716
2716
|
});
|
|
2717
2717
|
if (n.data && n.data.result === 0) {
|
|
2718
|
-
const o =
|
|
2718
|
+
const o = b.get(n.data, "retVal", []);
|
|
2719
2719
|
this.languages = o.map((s) => ({
|
|
2720
2720
|
langCode: s.language || s.langCode || s,
|
|
2721
2721
|
langName: s.langName || s.language || s
|
|
@@ -2910,7 +2910,7 @@ class lr {
|
|
|
2910
2910
|
type="text"
|
|
2911
2911
|
class="i18n-edit-input"
|
|
2912
2912
|
data-lang="${l.langCode}"
|
|
2913
|
-
value="${this.escapeHtml(
|
|
2913
|
+
value="${this.escapeHtml(b.get(o, l.langCode) || "")}"
|
|
2914
2914
|
placeholder="请输入${l.langName}翻译"
|
|
2915
2915
|
/>
|
|
2916
2916
|
</div>
|
|
@@ -2975,7 +2975,7 @@ class lr {
|
|
|
2975
2975
|
data: {
|
|
2976
2976
|
appCode: this.appCode,
|
|
2977
2977
|
commaSeparatedKeys: e,
|
|
2978
|
-
commaSeparatedLangs:
|
|
2978
|
+
commaSeparatedLangs: b.map(this.languages, "langCode").toString(),
|
|
2979
2979
|
searchBlur: "",
|
|
2980
2980
|
page: o,
|
|
2981
2981
|
pageSize: 10
|
|
@@ -2984,7 +2984,7 @@ class lr {
|
|
|
2984
2984
|
getRequestToken: this.getRequestToken
|
|
2985
2985
|
});
|
|
2986
2986
|
if (s.data && s.data.result === 0)
|
|
2987
|
-
return
|
|
2987
|
+
return b.get(s.data, "retVal.datas", []);
|
|
2988
2988
|
} catch (n) {
|
|
2989
2989
|
console.error("获取翻译数据失败:", n);
|
|
2990
2990
|
}
|
|
@@ -2995,8 +2995,8 @@ class lr {
|
|
|
2995
2995
|
*/
|
|
2996
2996
|
getChangedTranslationData(e, n, o) {
|
|
2997
2997
|
const s = o[0], i = (s == null ? void 0 : s.page) || "", r = [];
|
|
2998
|
-
return
|
|
2999
|
-
l !==
|
|
2998
|
+
return b.map(n, (l, a) => {
|
|
2999
|
+
l !== b.get(s, a) && r.push({
|
|
3000
3000
|
appCode: this.appCode,
|
|
3001
3001
|
page: i,
|
|
3002
3002
|
key: e,
|
|
@@ -3010,7 +3010,7 @@ class lr {
|
|
|
3010
3010
|
async saveTranslations(e, n, o) {
|
|
3011
3011
|
var r;
|
|
3012
3012
|
const s = this.getChangedTranslationData(e, n, o);
|
|
3013
|
-
if (
|
|
3013
|
+
if (b.isEmpty(s))
|
|
3014
3014
|
return !0;
|
|
3015
3015
|
const i = await Zt({
|
|
3016
3016
|
data: { data: s, isLocal: "F" },
|
|
@@ -3139,55 +3139,55 @@ function ur() {
|
|
|
3139
3139
|
},
|
|
3140
3140
|
_compress: function(a, d, u) {
|
|
3141
3141
|
if (a == null) return "";
|
|
3142
|
-
var h, f, x = {},
|
|
3142
|
+
var h, f, x = {}, L = {}, S = "", I = "", _ = "", w = 2, C = 3, v = 2, k = [], p = 0, m = 0, y;
|
|
3143
3143
|
for (y = 0; y < a.length; y += 1)
|
|
3144
|
-
if (
|
|
3144
|
+
if (S = a.charAt(y), Object.prototype.hasOwnProperty.call(x, S) || (x[S] = C++, L[S] = !0), I = _ + S, Object.prototype.hasOwnProperty.call(x, I))
|
|
3145
3145
|
_ = I;
|
|
3146
3146
|
else {
|
|
3147
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
3147
|
+
if (Object.prototype.hasOwnProperty.call(L, _)) {
|
|
3148
3148
|
if (_.charCodeAt(0) < 256) {
|
|
3149
3149
|
for (h = 0; h < v; h++)
|
|
3150
|
-
p = p << 1,
|
|
3150
|
+
p = p << 1, m == d - 1 ? (m = 0, k.push(u(p)), p = 0) : m++;
|
|
3151
3151
|
for (f = _.charCodeAt(0), h = 0; h < 8; h++)
|
|
3152
|
-
p = p << 1 | f & 1,
|
|
3152
|
+
p = p << 1 | f & 1, m == d - 1 ? (m = 0, k.push(u(p)), p = 0) : m++, f = f >> 1;
|
|
3153
3153
|
} else {
|
|
3154
3154
|
for (f = 1, h = 0; h < v; h++)
|
|
3155
|
-
p = p << 1 | f,
|
|
3155
|
+
p = p << 1 | f, m == d - 1 ? (m = 0, k.push(u(p)), p = 0) : m++, f = 0;
|
|
3156
3156
|
for (f = _.charCodeAt(0), h = 0; h < 16; h++)
|
|
3157
|
-
p = p << 1 | f & 1,
|
|
3157
|
+
p = p << 1 | f & 1, m == d - 1 ? (m = 0, k.push(u(p)), p = 0) : m++, f = f >> 1;
|
|
3158
3158
|
}
|
|
3159
|
-
w--, w == 0 && (w = Math.pow(2, v), v++), delete
|
|
3159
|
+
w--, w == 0 && (w = Math.pow(2, v), v++), delete L[_];
|
|
3160
3160
|
} else
|
|
3161
3161
|
for (f = x[_], h = 0; h < v; h++)
|
|
3162
|
-
p = p << 1 | f & 1,
|
|
3163
|
-
w--, w == 0 && (w = Math.pow(2, v), v++), x[I] = C++, _ = String(
|
|
3162
|
+
p = p << 1 | f & 1, m == d - 1 ? (m = 0, k.push(u(p)), p = 0) : m++, f = f >> 1;
|
|
3163
|
+
w--, w == 0 && (w = Math.pow(2, v), v++), x[I] = C++, _ = String(S);
|
|
3164
3164
|
}
|
|
3165
3165
|
if (_ !== "") {
|
|
3166
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
3166
|
+
if (Object.prototype.hasOwnProperty.call(L, _)) {
|
|
3167
3167
|
if (_.charCodeAt(0) < 256) {
|
|
3168
3168
|
for (h = 0; h < v; h++)
|
|
3169
|
-
p = p << 1,
|
|
3169
|
+
p = p << 1, m == d - 1 ? (m = 0, k.push(u(p)), p = 0) : m++;
|
|
3170
3170
|
for (f = _.charCodeAt(0), h = 0; h < 8; h++)
|
|
3171
|
-
p = p << 1 | f & 1,
|
|
3171
|
+
p = p << 1 | f & 1, m == d - 1 ? (m = 0, k.push(u(p)), p = 0) : m++, f = f >> 1;
|
|
3172
3172
|
} else {
|
|
3173
3173
|
for (f = 1, h = 0; h < v; h++)
|
|
3174
|
-
p = p << 1 | f,
|
|
3174
|
+
p = p << 1 | f, m == d - 1 ? (m = 0, k.push(u(p)), p = 0) : m++, f = 0;
|
|
3175
3175
|
for (f = _.charCodeAt(0), h = 0; h < 16; h++)
|
|
3176
|
-
p = p << 1 | f & 1,
|
|
3176
|
+
p = p << 1 | f & 1, m == d - 1 ? (m = 0, k.push(u(p)), p = 0) : m++, f = f >> 1;
|
|
3177
3177
|
}
|
|
3178
|
-
w--, w == 0 && (w = Math.pow(2, v), v++), delete
|
|
3178
|
+
w--, w == 0 && (w = Math.pow(2, v), v++), delete L[_];
|
|
3179
3179
|
} else
|
|
3180
3180
|
for (f = x[_], h = 0; h < v; h++)
|
|
3181
|
-
p = p << 1 | f & 1,
|
|
3181
|
+
p = p << 1 | f & 1, m == d - 1 ? (m = 0, k.push(u(p)), p = 0) : m++, f = f >> 1;
|
|
3182
3182
|
w--, w == 0 && (w = Math.pow(2, v), v++);
|
|
3183
3183
|
}
|
|
3184
3184
|
for (f = 2, h = 0; h < v; h++)
|
|
3185
|
-
p = p << 1 | f & 1,
|
|
3185
|
+
p = p << 1 | f & 1, m == d - 1 ? (m = 0, k.push(u(p)), p = 0) : m++, f = f >> 1;
|
|
3186
3186
|
for (; ; )
|
|
3187
|
-
if (p = p << 1,
|
|
3187
|
+
if (p = p << 1, m == d - 1) {
|
|
3188
3188
|
k.push(u(p));
|
|
3189
3189
|
break;
|
|
3190
|
-
} else
|
|
3190
|
+
} else m++;
|
|
3191
3191
|
return k.join("");
|
|
3192
3192
|
},
|
|
3193
3193
|
decompress: function(a) {
|
|
@@ -3196,7 +3196,7 @@ function ur() {
|
|
|
3196
3196
|
});
|
|
3197
3197
|
},
|
|
3198
3198
|
_decompress: function(a, d, u) {
|
|
3199
|
-
var h = [], f = 4, x = 4,
|
|
3199
|
+
var h = [], f = 4, x = 4, L = 3, S = "", I = [], _, w, C, v, k, p, m, y = { val: u(0), position: d, index: 1 };
|
|
3200
3200
|
for (_ = 0; _ < 3; _ += 1)
|
|
3201
3201
|
h[_] = _;
|
|
3202
3202
|
for (C = 0, k = Math.pow(2, 2), p = 1; p != k; )
|
|
@@ -3205,42 +3205,42 @@ function ur() {
|
|
|
3205
3205
|
case 0:
|
|
3206
3206
|
for (C = 0, k = Math.pow(2, 8), p = 1; p != k; )
|
|
3207
3207
|
v = y.val & y.position, y.position >>= 1, y.position == 0 && (y.position = d, y.val = u(y.index++)), C |= (v > 0 ? 1 : 0) * p, p <<= 1;
|
|
3208
|
-
|
|
3208
|
+
m = n(C);
|
|
3209
3209
|
break;
|
|
3210
3210
|
case 1:
|
|
3211
3211
|
for (C = 0, k = Math.pow(2, 16), p = 1; p != k; )
|
|
3212
3212
|
v = y.val & y.position, y.position >>= 1, y.position == 0 && (y.position = d, y.val = u(y.index++)), C |= (v > 0 ? 1 : 0) * p, p <<= 1;
|
|
3213
|
-
|
|
3213
|
+
m = n(C);
|
|
3214
3214
|
break;
|
|
3215
3215
|
case 2:
|
|
3216
3216
|
return "";
|
|
3217
3217
|
}
|
|
3218
|
-
for (h[3] =
|
|
3218
|
+
for (h[3] = m, w = m, I.push(m); ; ) {
|
|
3219
3219
|
if (y.index > a)
|
|
3220
3220
|
return "";
|
|
3221
|
-
for (C = 0, k = Math.pow(2,
|
|
3221
|
+
for (C = 0, k = Math.pow(2, L), p = 1; p != k; )
|
|
3222
3222
|
v = y.val & y.position, y.position >>= 1, y.position == 0 && (y.position = d, y.val = u(y.index++)), C |= (v > 0 ? 1 : 0) * p, p <<= 1;
|
|
3223
|
-
switch (
|
|
3223
|
+
switch (m = C) {
|
|
3224
3224
|
case 0:
|
|
3225
3225
|
for (C = 0, k = Math.pow(2, 8), p = 1; p != k; )
|
|
3226
3226
|
v = y.val & y.position, y.position >>= 1, y.position == 0 && (y.position = d, y.val = u(y.index++)), C |= (v > 0 ? 1 : 0) * p, p <<= 1;
|
|
3227
|
-
h[x++] = n(C),
|
|
3227
|
+
h[x++] = n(C), m = x - 1, f--;
|
|
3228
3228
|
break;
|
|
3229
3229
|
case 1:
|
|
3230
3230
|
for (C = 0, k = Math.pow(2, 16), p = 1; p != k; )
|
|
3231
3231
|
v = y.val & y.position, y.position >>= 1, y.position == 0 && (y.position = d, y.val = u(y.index++)), C |= (v > 0 ? 1 : 0) * p, p <<= 1;
|
|
3232
|
-
h[x++] = n(C),
|
|
3232
|
+
h[x++] = n(C), m = x - 1, f--;
|
|
3233
3233
|
break;
|
|
3234
3234
|
case 2:
|
|
3235
3235
|
return I.join("");
|
|
3236
3236
|
}
|
|
3237
|
-
if (f == 0 && (f = Math.pow(2,
|
|
3238
|
-
|
|
3239
|
-
else if (
|
|
3240
|
-
|
|
3237
|
+
if (f == 0 && (f = Math.pow(2, L), L++), h[m])
|
|
3238
|
+
S = h[m];
|
|
3239
|
+
else if (m === x)
|
|
3240
|
+
S = w + w.charAt(0);
|
|
3241
3241
|
else
|
|
3242
3242
|
return null;
|
|
3243
|
-
I.push(
|
|
3243
|
+
I.push(S), h[x++] = w + S.charAt(0), f--, w = S, f == 0 && (f = Math.pow(2, L), L++);
|
|
3244
3244
|
}
|
|
3245
3245
|
}
|
|
3246
3246
|
};
|
|
@@ -3486,11 +3486,11 @@ const Ht = {
|
|
|
3486
3486
|
Array.from(new Set(v)).forEach((k) => {
|
|
3487
3487
|
k.postMessage(w, C);
|
|
3488
3488
|
});
|
|
3489
|
-
},
|
|
3489
|
+
}, L = () => {
|
|
3490
3490
|
window.addEventListener("storage", (w) => {
|
|
3491
3491
|
w.key === "I18N_LANGUAGE" && (n.value = w.newValue || "zh-CN");
|
|
3492
3492
|
});
|
|
3493
|
-
},
|
|
3493
|
+
}, S = async () => {
|
|
3494
3494
|
i.value.length === 0 && await l();
|
|
3495
3495
|
const w = i.value.map(
|
|
3496
3496
|
(k) => `
|
|
@@ -3528,12 +3528,12 @@ const Ht = {
|
|
|
3528
3528
|
k.forEach((y) => {
|
|
3529
3529
|
p[y.getAttribute("data-lang")] = y.value;
|
|
3530
3530
|
});
|
|
3531
|
-
const
|
|
3532
|
-
if (
|
|
3531
|
+
const m = document.getElementById("i18n-save-error");
|
|
3532
|
+
if (m && (m.style.display = "none", m.textContent = ""), t.request && typeof t.request == "function")
|
|
3533
3533
|
try {
|
|
3534
3534
|
return await t.request(p), p;
|
|
3535
3535
|
} catch (y) {
|
|
3536
|
-
return
|
|
3536
|
+
return m && (m.textContent = y.message || "保存失败", m.style.display = "block"), !1;
|
|
3537
3537
|
}
|
|
3538
3538
|
return p;
|
|
3539
3539
|
}
|
|
@@ -3593,10 +3593,10 @@ const Ht = {
|
|
|
3593
3593
|
}
|
|
3594
3594
|
});
|
|
3595
3595
|
}, _ = () => {
|
|
3596
|
-
t.request && typeof t.request == "function" ?
|
|
3596
|
+
t.request && typeof t.request == "function" ? S() : I();
|
|
3597
3597
|
};
|
|
3598
3598
|
return to(() => {
|
|
3599
|
-
r(), l(), window.addEventListener("message", f),
|
|
3599
|
+
r(), l(), window.addEventListener("message", f), L();
|
|
3600
3600
|
}), {
|
|
3601
3601
|
currentValue: d,
|
|
3602
3602
|
openModal: _
|
|
@@ -3694,15 +3694,15 @@ function yr(t) {
|
|
|
3694
3694
|
}
|
|
3695
3695
|
},
|
|
3696
3696
|
// 翻译函数(支持嵌套 key 的点号访问)
|
|
3697
|
-
t(f, x,
|
|
3698
|
-
const
|
|
3699
|
-
x =
|
|
3697
|
+
t(f, x, L) {
|
|
3698
|
+
const S = Xn(x, L);
|
|
3699
|
+
x = S.defaultValue, L = S.values, i.value, l && l.messageVersion;
|
|
3700
3700
|
const I = a();
|
|
3701
3701
|
if (I === "zh-CN" && !f.startsWith("i.") && !f.startsWith("pro."))
|
|
3702
|
-
return pe(x || f,
|
|
3702
|
+
return pe(x || f, L);
|
|
3703
3703
|
const _ = Ft(o, I);
|
|
3704
3704
|
let w = _[f];
|
|
3705
|
-
return w === void 0 && f.includes(".") && (w = f.split(".").reduce((v, k) => v && typeof v == "object" ? v[k] : void 0, _)),
|
|
3705
|
+
return w === void 0 && f.includes(".") && (w = f.split(".").reduce((v, k) => v && typeof v == "object" ? v[k] : void 0, _)), w != null && w !== f ? pe(w, L) : pe(x || f, L);
|
|
3706
3706
|
},
|
|
3707
3707
|
// 设置某个语言的所有消息
|
|
3708
3708
|
setLocaleMessage(f, x) {
|
|
@@ -3823,10 +3823,10 @@ class J {
|
|
|
3823
3823
|
locale: h,
|
|
3824
3824
|
env: f,
|
|
3825
3825
|
dev: x,
|
|
3826
|
-
i18nTokenRequest:
|
|
3827
|
-
auth:
|
|
3826
|
+
i18nTokenRequest: L,
|
|
3827
|
+
auth: S
|
|
3828
3828
|
} = e;
|
|
3829
|
-
this.env = f || "local", this.baseUrl = Kt({ env: f, dev: x }), this.i18nTokenRequest =
|
|
3829
|
+
this.env = f || "local", this.baseUrl = Kt({ env: f, dev: x }), this.i18nTokenRequest = L || null, this.baseToken = i || (E.get("I18N_CONFIG") || {}).token || E.get("token"), this.token = this.baseToken, this.auth = S || null, this.authInfo = {
|
|
3830
3830
|
appCode: o,
|
|
3831
3831
|
orgCode: r || "",
|
|
3832
3832
|
userCode: l || ""
|
|
@@ -4175,12 +4175,12 @@ class J {
|
|
|
4175
4175
|
const a = (h = n.router) == null ? void 0 : h.currentRoute, d = (f = (a == null ? void 0 : a.value) ?? a) == null ? void 0 : f.name;
|
|
4176
4176
|
let u;
|
|
4177
4177
|
if (d) {
|
|
4178
|
-
const x = `${d}.${o}`,
|
|
4179
|
-
if (
|
|
4180
|
-
u =
|
|
4178
|
+
const x = `${d}.${o}`, L = n.i18n.t(x, void 0, i);
|
|
4179
|
+
if (L !== x)
|
|
4180
|
+
u = L;
|
|
4181
4181
|
else {
|
|
4182
|
-
const
|
|
4183
|
-
I !==
|
|
4182
|
+
const S = `common.${o}`, I = n.i18n.t(S, void 0, i);
|
|
4183
|
+
I !== S ? u = I : u = n.i18n.t(o, void 0, i);
|
|
4184
4184
|
}
|
|
4185
4185
|
} else
|
|
4186
4186
|
u = n.i18n.t(o, void 0, i);
|
|
@@ -4310,7 +4310,7 @@ class J {
|
|
|
4310
4310
|
e = this.normalizeLocale(e);
|
|
4311
4311
|
const o = n.cacheScope || this.activeCacheScope || "guest", s = n.authVersion || this.authVersion, i = ++this.languageVersion, r = "I18N_MESSAGES_COMMON_" + e;
|
|
4312
4312
|
let l = E.get(r);
|
|
4313
|
-
if (
|
|
4313
|
+
if (b.isEmpty(l))
|
|
4314
4314
|
try {
|
|
4315
4315
|
const a = await Jn.get(
|
|
4316
4316
|
`https://cdn.ihotel.cn/i18n_messages/${e}.json`
|
|
@@ -4338,18 +4338,18 @@ class J {
|
|
|
4338
4338
|
if (s !== this.authVersion || i !== this.languageVersion)
|
|
4339
4339
|
return !1;
|
|
4340
4340
|
if (a && Array.isArray(a)) {
|
|
4341
|
-
const d = so(a), u =
|
|
4341
|
+
const d = so(a), u = b.assign(
|
|
4342
4342
|
{},
|
|
4343
4343
|
l,
|
|
4344
|
-
|
|
4344
|
+
b.get(this.messages, e),
|
|
4345
4345
|
d
|
|
4346
4346
|
);
|
|
4347
4347
|
this.i18n.global.setLocaleMessage(e, u);
|
|
4348
4348
|
} else {
|
|
4349
|
-
const d =
|
|
4349
|
+
const d = b.assign(
|
|
4350
4350
|
{},
|
|
4351
4351
|
l,
|
|
4352
|
-
|
|
4352
|
+
b.get(this.messages, e)
|
|
4353
4353
|
);
|
|
4354
4354
|
this.i18n.global.setLocaleMessage(e, d);
|
|
4355
4355
|
}
|
|
@@ -4357,10 +4357,10 @@ class J {
|
|
|
4357
4357
|
} catch (a) {
|
|
4358
4358
|
if (console.error(`设置语言 ${e} 失败,使用本地消息继续运行:`, a), s !== this.authVersion || i !== this.languageVersion)
|
|
4359
4359
|
return !1;
|
|
4360
|
-
const d =
|
|
4360
|
+
const d = b.assign(
|
|
4361
4361
|
{},
|
|
4362
4362
|
l,
|
|
4363
|
-
|
|
4363
|
+
b.get(this.messages, e)
|
|
4364
4364
|
);
|
|
4365
4365
|
return this.i18n.global.setLocaleMessage(e, d), this.locale = e, this._isRTL = Ee(e), this.i18n.global.locale.value = e, E.set("I18N_LANGUAGE", e), this.persistI18nConfig(), this.updateDocumentDir(), this.notifyLanguageChanged(e, !1), !1;
|
|
4366
4366
|
}
|