refactor: 统一项目内国际化key的命名空间格式

本次提交对全项目的国际化调用进行了规范化重构:
1. 为中文/英文语言包新增了avatar和gender的别名映射,兼容旧有headImg/sex写法
2. 修正了lang.js中的注释路径错误
3. 将所有页面和组件内的$lang调用从短路径改为带业务模块前缀的完整命名空间路径,例如将$lang('title')改为$lang('article.list.title')
4. 优化了i18n-lazy.js的注释说明,补充了正确的key命名格式示例
5. 统一了分销、订单、会员等模块的国际化key层级,确保所有语言调用路径一致
This commit is contained in:
2026-07-04 09:24:35 +08:00
parent 92e8823566
commit 783c10fc62
98 changed files with 1543 additions and 1530 deletions

View File

@@ -53,56 +53,56 @@ export default {
begin_time:'',//团购开始时间
end_time:''//团购结束时间
},
groundingArray: [this.$lang('grounding.offShelf'), this.$lang('grounding.onShelf')],
groundingArray: [this.$lang('merch.edit.grounding.offShelf'), this.$lang('merch.edit.grounding.onShelf')],
pickuptypeArray: [this.$lang('pickupType.sameDay'), this.$lang('pickupType.nextDay'), this.$lang('pickupType.dayAfter')],//, '自定义'
pickuptypeArray: [this.$lang('merch.edit.pickupType.sameDay'), this.$lang('merch.edit.pickupType.nextDay'), this.$lang('merch.edit.pickupType.dayAfter')],//, '自定义'
currCategory: 0, // 当前所设置的商品分类
virtualDeliverArray: [{
name: this.$lang('virtualDeliver.auto'),
value: 'auto_deliver',
},
{
name: this.$lang('virtualDeliver.manual'),
value: 'artificial_deliver',
},
{
name: this.$lang('virtualDeliver.verify'),
value: 'verify',
}
],
virtualDeliverValue: {
'auto_deliver': this.$lang('virtualDeliver.auto'),
'artificial_deliver': this.$lang('virtualDeliver.manual'),
'verify': this.$lang('virtualDeliver.verify')
virtualDeliverArray: [{
name: this.$lang('merch.edit.virtualDeliver.auto'),
value: 'auto_deliver',
},
{
name: this.$lang('merch.edit.virtualDeliver.manual'),
value: 'artificial_deliver',
},
{
name: this.$lang('merch.edit.virtualDeliver.verify'),
value: 'verify',
}
],
virtualDeliverValue: {
'auto_deliver': this.$lang('merch.edit.virtualDeliver.auto'),
'artificial_deliver': this.$lang('merch.edit.virtualDeliver.manual'),
'verify': this.$lang('merch.edit.virtualDeliver.verify')
},
virtualReceiveArray: [{
name: this.$lang('virtualReceive.auto'),
value: 'auto_receive',
},
{
name: this.$lang('virtualReceive.buyerConfirm'),
value: 'artificial_receive',
},
],
virtualReceiveValue: {
'auto_receive': this.$lang('virtualReceive.auto'),
'artificial_receive': this.$lang('virtualReceive.buyerConfirm'),
virtualReceiveArray: [{
name: this.$lang('merch.edit.virtualReceive.auto'),
value: 'auto_receive',
},
{
name: this.$lang('merch.edit.virtualReceive.buyerConfirm'),
value: 'artificial_receive',
},
],
virtualReceiveValue: {
'auto_receive': this.$lang('merch.edit.virtualReceive.auto'),
'artificial_receive': this.$lang('merch.edit.virtualReceive.buyerConfirm'),
},
validityTypeArray: [this.$lang('validityType.permanent'), this.$lang('validityType.daysAfterPurchase'), this.$lang('validityType.specifiedDate')],
validityTypeArray: [this.$lang('merch.edit.validityType.permanent'), this.$lang('merch.edit.validityType.daysAfterPurchase'), this.$lang('merch.edit.validityType.specifiedDate')],
virtualIndate: 0,
minDate: '',
carmiLength: this.$lang('carmi.add'),
limitLength: [ //限购
{
name: this.$lang('limitType.single'),
value: '1'
},
{
name: this.$lang('limitType.longTerm'),
value: '2'
}
carmiLength: this.$lang('merch.edit.carmi.add'),
limitLength: [ //限购
{
name: this.$lang('merch.edit.limitType.single'),
value: '1'
},
{
name: this.$lang('merch.edit.limitType.longTerm'),
value: '2'
}
],
current: 0,
goodsFormArray: [],
@@ -122,12 +122,12 @@ export default {
// this.getCategoryTreeFn();
if (this.goodsData.id) {
this.isAWait = true;
this.$langConfig.title(this.$lang('title'));
this.$langConfig.title(this.$lang('merch.edit.title'));
await this.editGetGoodsInfo();
} else {
this.isAWait = false;
this.$langConfig.title(this.$lang('addTitle'));
this.$langConfig.title(this.$lang('merch.edit.addTitle'));
}
let date = new Date();
@@ -163,7 +163,7 @@ export default {
if(res.result.detail){
this.goodsData = res.result.detail
this.$util.showToast({
title: this.$lang('message.goodsNotExist'),
title: this.$lang('merch.edit.message.goodsNotExist'),
});
setTimeout(() => {
this.$util.redirectTo('/pages_goods/list', {}, 'redirectTo');
@@ -489,7 +489,7 @@ export default {
addShopCategory() {
if (this.shopCategoryNumber == 10) {
this.$util.showToast({
title: this.$lang('message.maxCategory')
title: this.$lang('merch.edit.message.maxCategory')
});
return;
}
@@ -526,7 +526,7 @@ export default {
this.goodsData.carmichael = uni.getStorageSync('editGoodsCarmichael') ? JSON.parse(uni.getStorageSync('editGoodsCarmichael')) : [];
if (this.goodsData.carmichael.length > 0) {
this.carmiLength = this.$lang('carmi.addWithCount', { count: this.goodsData.carmichael.length })
this.carmiLength = this.$lang('merch.edit.carmi.addWithCount', { count: this.goodsData.carmichael.length })
}
}
@@ -564,21 +564,21 @@ export default {
if (this.goodsData.goodsname.length == 0) {
this.$util.showToast({
title: this.$lang('message.pleaseEnterGoodsName')
title: this.$lang('merch.edit.message.pleaseEnterGoodsName')
});
return false;
}
if (this.goodsData.subtitle.length > 100) {
this.$util.showToast({
title: this.$lang('message.subtitleMaxLength', { max: 100 })
title: this.$lang('merch.edit.message.subtitleMaxLength', { max: 100 })
});
return false;
}
if (this.goodsData.goods_image.length == 0) {
this.$util.showToast({
title: this.$lang('message.pleaseUploadGoodsImage')
title: this.$lang('merch.edit.message.pleaseUploadGoodsImage')
});
return false;
}
@@ -628,20 +628,20 @@ export default {
if (this.goodsData.price == 0) {
this.$util.showToast({
title: this.$lang('message.pleaseEnterSalePrice')
title: this.$lang('merch.edit.message.pleaseEnterSalePrice')
});
return false;
}
if (isNaN(this.goodsData.price) || !this.$util.data().regExp.digit.test(this.goodsData.price)) {
this.$util.showToast({
title: this.$lang('message.salePriceFormatError')
title: this.$lang('merch.edit.message.salePriceFormatError')
});
return false;
}
if (this.goodsData.productprice.length > 0 && (isNaN(this.goodsData.productprice) || !this.$util.data().regExp.digit.test(this.goodsData.productprice))) {
this.$util.showToast({
title: this.$lang('message.originalPriceFormatError')
title: this.$lang('merch.edit.message.originalPriceFormatError')
});
return false;
}
@@ -651,26 +651,26 @@ export default {
// 总库存
if (this.goodsData.total == 0) {
this.$util.showToast({
title: this.$lang('message.pleaseEnterStock')
title: this.$lang('merch.edit.message.pleaseEnterStock')
});
return false;
}
if (isNaN(this.goodsData.total) || !this.$util.data().regExp.number.test(this.goodsData.total)) {
this.$util.showToast({
title: this.$lang('message.stockFormatError')
title: this.$lang('merch.edit.message.stockFormatError')
});
return false;
}
if (isNaN(this.goodsData.goods_start_count) || !this.$util.data().regExp.number.test(this.goodsData.goods_start_count)) {
this.$util.showToast({
title: this.$lang('message.minOrderFormatError')
title: this.$lang('merch.edit.message.minOrderFormatError')
});
return false;
}
if (this.goodsData.goods_start_count < 0) {
this.$util.showToast({
title: this.$lang('message.minOrderNotLessThanZero')
title: this.$lang('merch.edit.message.minOrderNotLessThanZero')
});
return false;
}
@@ -901,7 +901,7 @@ export default {
getGoodsForm() {
getOrderFormList().then(res=>{
if (res.data) {
let goodsForm = [this.$lang('placeholder.selectGoodsForm')];
let goodsForm = [this.$lang('merch.edit.placeholder.selectGoodsForm')];
res.data.forEach((item, index) => {
goodsForm.push(item.form_name);
if (this.goodsData.form_id && this.goodsData.form_id == item.id) this.goodsData.goods_form_index = index + 1;
@@ -922,7 +922,7 @@ export default {
getSupplyList() {
getSupplyList().then(res=>{
if (res.data) {
let supplyForm = [this.$lang('placeholder.selectSupplier')];
let supplyForm = [this.$lang('merch.edit.placeholder.selectSupplier')];
res.data.forEach((item, index) => {
supplyForm.push(item.title);
if (this.goodsData.supplier_id && this.goodsData.supplier_id == item.supplier_id) this.goodsData.supply_index = index + 1;