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:
@@ -318,9 +318,9 @@ export default {
|
||||
|
||||
let list = this.couponList;
|
||||
if (res.data.is_exist == 1 && res.code < 0) {
|
||||
msg = this.$lang('couponAlreadyClaimed');
|
||||
msg = this.$lang('goods.detail.couponAlreadyClaimed');
|
||||
} else if (res.code == 0) {
|
||||
msg = this.$lang('couponClaimSuccess');
|
||||
msg = this.$lang('goods.detail.couponClaimSuccess');
|
||||
} else {
|
||||
msg = res.message;
|
||||
}
|
||||
@@ -362,7 +362,7 @@ export default {
|
||||
//获取满减信息
|
||||
getManjian(data) {
|
||||
this.manjian = data;
|
||||
let limit = data.type == 0 ? this.$lang('manjianUnitYuan') : this.$lang('manjianUnitPiece');
|
||||
let limit = data.type == 0 ? this.$lang('goods.detail.manjianUnitYuan') : this.$lang('goods.detail.manjianUnitPiece');
|
||||
Object.keys(data.rule_json).forEach((key) => {
|
||||
var item = data.rule_json[key];
|
||||
if (item.coupon_data) {
|
||||
@@ -373,46 +373,46 @@ export default {
|
||||
item.limit = data.type == 0 ? parseFloat(item.limit).toFixed(2) : parseInt(item.limit);
|
||||
// 满减
|
||||
if (item.discount_money != undefined) {
|
||||
let itemText = this.$lang('fullReductionItem', { limit: item.limit, unit: limit, money: item.discount_money });
|
||||
let itemText = this.$lang('goods.detail.fullReductionItem', { limit: item.limit, unit: limit, money: item.discount_money });
|
||||
if (this.manjian.manjian == undefined) {
|
||||
this.manjian.manjian = itemText;
|
||||
} else {
|
||||
this.manjian.manjian += this.$lang('manjianItemSeparator') + itemText;
|
||||
this.manjian.manjian += this.$lang('goods.detail.manjianItemSeparator') + itemText;
|
||||
}
|
||||
}
|
||||
// 满送
|
||||
if (item.point != undefined || item.coupon != undefined) {
|
||||
let text = '';
|
||||
if (item.point != undefined) {
|
||||
text = this.$lang('fullGiftPoints', { point: item.point });
|
||||
text = this.$lang('goods.detail.fullGiftPoints', { point: item.point });
|
||||
}
|
||||
if (item.coupon != undefined && item.coupon_data != undefined) {
|
||||
item.coupon_data.forEach((couponItem, couponIndex) => {
|
||||
if (couponItem.type == 'discount') {
|
||||
let couponText = this.$lang('fullGiftDiscountCoupon', { count: item.coupon_num[couponIndex], discount: parseFloat(couponItem.discount) });
|
||||
let couponText = this.$lang('goods.detail.fullGiftDiscountCoupon', { count: item.coupon_num[couponIndex], discount: parseFloat(couponItem.discount) });
|
||||
if (text == '') text = couponText;
|
||||
else text += this.$lang('fullGiftConnector') + couponText;
|
||||
else text += this.$lang('goods.detail.fullGiftConnector') + couponText;
|
||||
} else {
|
||||
let couponText = this.$lang('fullGiftMoneyCoupon', { count: item.coupon_num[couponIndex], money: parseFloat(couponItem.money) });
|
||||
let couponText = this.$lang('goods.detail.fullGiftMoneyCoupon', { count: item.coupon_num[couponIndex], money: parseFloat(couponItem.money) });
|
||||
if (text == '') text = couponText;
|
||||
else text += this.$lang('fullGiftConnector') + couponText;
|
||||
else text += this.$lang('goods.detail.fullGiftConnector') + couponText;
|
||||
}
|
||||
})
|
||||
}
|
||||
let giftItemText = this.$lang('fullGiftItem', { limit: item.limit, unit: limit, gift: text });
|
||||
let giftItemText = this.$lang('goods.detail.fullGiftItem', { limit: item.limit, unit: limit, gift: text });
|
||||
if (this.manjian.mansong == undefined) {
|
||||
this.manjian.mansong = giftItemText;
|
||||
} else {
|
||||
this.manjian.mansong += this.$lang('manjianItemSeparator') + giftItemText;
|
||||
this.manjian.mansong += this.$lang('goods.detail.manjianItemSeparator') + giftItemText;
|
||||
}
|
||||
}
|
||||
// 包邮
|
||||
if (item.free_shipping != undefined) {
|
||||
let itemText = this.$lang('freeShippingItem', { limit: item.limit, unit: limit });
|
||||
let itemText = this.$lang('goods.detail.freeShippingItem', { limit: item.limit, unit: limit });
|
||||
if (this.manjian.free_shipping == undefined) {
|
||||
this.manjian.free_shipping = itemText;
|
||||
} else {
|
||||
this.manjian.free_shipping += this.$lang('manjianItemSeparator') + itemText;
|
||||
this.manjian.free_shipping += this.$lang('goods.detail.manjianItemSeparator') + itemText;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user