webpack-gc-i18n-plugin 1.1.6 → 1.1.7
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/dist/customLoader/index.cjs +14 -4
- package/dist/customLoader/index.cjs.map +1 -1
- package/dist/customLoader/index.mjs +14 -4
- package/dist/customLoader/index.mjs.map +1 -1
- package/dist/index.cjs +14 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +14 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1432,12 +1432,22 @@ function translateSetLang(node) {
|
|
|
1432
1432
|
let arg = node.arguments || [];
|
|
1433
1433
|
// 提取参数作为值
|
|
1434
1434
|
// 检查参数是否为字符串字面量
|
|
1435
|
-
const
|
|
1436
|
-
const
|
|
1435
|
+
const idArg = arg[0];
|
|
1436
|
+
const valueArg = arg[1];
|
|
1437
|
+
const id = types__namespace.isStringLiteral(idArg) ? idArg.value : '';
|
|
1438
|
+
const value = types__namespace.isStringLiteral(valueArg) ? valueArg.value : '';
|
|
1437
1439
|
// 检查 ID 和值是否存在,并且第二个参数是字符串字面量
|
|
1438
|
-
if (id && value && types__namespace.isStringLiteral(
|
|
1440
|
+
if (id && value && types__namespace.isStringLiteral(idArg) && types__namespace.isStringLiteral(valueArg)) {
|
|
1441
|
+
const resolvedId = resolveLangKey(id, value);
|
|
1442
|
+
if (resolvedId !== id) {
|
|
1443
|
+
idArg.value = resolvedId;
|
|
1444
|
+
idArg.extra = {
|
|
1445
|
+
raw: `'${resolvedId}'`,
|
|
1446
|
+
rawValue: resolvedId
|
|
1447
|
+
};
|
|
1448
|
+
}
|
|
1439
1449
|
// 调用翻译工具的 setLangObj 方法设置语言对象属性
|
|
1440
|
-
setLangObj(
|
|
1450
|
+
setLangObj(resolvedId, value);
|
|
1441
1451
|
}
|
|
1442
1452
|
}
|
|
1443
1453
|
|