feat: 新增多语言文案并修复动态国际化调用问题

1. 新增多语言文件覆盖组件、页面、公共模块的翻译文案
2. 修复多处动态拼接lang key的调用,增加兜底逻辑避免空值或原始key暴露
3. 补全DIY组件、业务页面的国际化适配
4. 新增P2动态key国际化处理方案文档
This commit is contained in:
2026-06-29 15:29:24 +08:00
parent c3956f7bcd
commit c7810f16f7
115 changed files with 1343 additions and 153 deletions

View File

@@ -33,8 +33,8 @@ export default {
} else {
fallbackFunc && fallbackFunc(res);
this.$util.showToast({
title: res.message ? res.message : '小程序配置错误'
});
title: res.message ? res.message : this.$lang('common.auth.miniProgramConfigError')
});
}
}
})
@@ -74,8 +74,8 @@ export default {
} else {
fallbackFunc && fallbackFunc(res);
this.$util.showToast({
title: res.message ? res.message : '小程序配置错误'
});
title: res.message ? res.message : this.$lang('common.auth.miniProgramConfigError')
});
}
}
})

View File

@@ -141,7 +141,7 @@ export default {
});
this.goodsSkuDetail.swiperHeight = maxHeight + 'px';
this.goodsSkuDetail.unit = this.goodsSkuDetail.unit || "件";
this.goodsSkuDetail.unit = this.goodsSkuDetail.unit || this.$lang('unit.piece');
// 当前商品SKU规格
if (this.goodsSkuDetail.sku_spec_format) this.goodsSkuDetail.sku_spec_format = JSON.parse(this.goodsSkuDetail.sku_spec_format);
@@ -199,7 +199,7 @@ export default {
if (this.$refs.goodsDetailView) {
// 初始化商品详情视图数据
this.goodsSkuDetail.unit = this.goodsSkuDetail.unit || "件";
this.goodsSkuDetail.unit = this.goodsSkuDetail.unit || this.$lang('unit.piece');
// 解决轮播图数量不一致时,切换到第一个
if (this.swiperCurrent > this.goodsSkuDetail.sku_images.length) {

View File

@@ -42,6 +42,12 @@ const SHARED_LANG_PACKS = [
'components/register-reward',
'components/wxwork-contact',
'components/yuyue-date',
'components/chat-message',
'components/pick-regions',
'components/ns-goods-sku',
'components/ns-chat-receiveGoods',
'components/ns-chat-goods',
'components/ns-video-player-popup',
'components-diy/diy-article',
'components-diy/diy-bargain',
'components-diy/diy-category',
@@ -58,6 +64,16 @@ const SHARED_LANG_PACKS = [
'components-diy/diy-seckill',
'components-diy/diy-store',
'components-diy/diy-video',
'components-diy/diy-search',
'components-diy/diy-map',
'components-diy/diy-kefu',
'components-diy/diy-channel-video',
'components-diy/diy-live',
'components-diy/diy-listmenu',
'components-diy/diy-text',
'components-diy/diy-goods-recommend',
'components-diy/diy-notes',
'member/public',
];
function toCamelCaseName(name) {

View File

@@ -1,5 +1,6 @@
import util from '@/common/js/util.js'
import TransformCoordinate from './transformCoordinate.js'
import Lang from '@/common/js/lang.js'
function openMapByDefault(latitude, longitude, name) {
uni.openLocation({
@@ -8,7 +9,7 @@ function openMapByDefault(latitude, longitude, name) {
name: name,
fail: (e) => {
uni.showModal({
content: '打开地图失败,请稍后重试'
content: Lang.lang('common.map.openMapFailed')
})
},
})