i18n: 替换所有硬编码文本为多语言配置
将项目中各处的硬编码字符串替换为国际化语言包调用,统一管理页面和组件的文案内容,方便后续多语言适配与维护
This commit is contained in:
@@ -233,14 +233,14 @@ export default {
|
||||
}
|
||||
if (cart_id.length == 0) {
|
||||
this.$util.showToast({
|
||||
title: '请选择要删除的商品'
|
||||
title: this.$lang('cart.selectGoodsToDelete')
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: cart_id.length > 1 ? '确定要删除这些商品吗?' : '确定要删除该商品吗?',
|
||||
title: this.$lang('common.tip'),
|
||||
content: cart_id.length > 1 ? this.$lang('cart.confirmDeleteSelected') : this.$lang('cart.confirmDeleteOne'),
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
cart_id = cart_id.toString();
|
||||
@@ -381,8 +381,8 @@ export default {
|
||||
*/
|
||||
clearInvalidGoods() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要清空这些商品吗?',
|
||||
title: this.$lang('common.tip'),
|
||||
content: this.$lang('cart.confirmClearInvalid'),
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
var cart_ids = [];
|
||||
@@ -432,11 +432,11 @@ export default {
|
||||
if (event.type == 'plus') {
|
||||
if (data.max_buy > 0 && data.max_buy < data.stock) {
|
||||
this.$util.showToast({
|
||||
title: '该商品每人限购' + data.max_buy + '件'
|
||||
title: this.$lang('cart.personLimit', { count: data.max_buy })
|
||||
});
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: '库存不足'
|
||||
title: this.$lang('sku.insufficientStock')
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -318,9 +318,9 @@ export default {
|
||||
|
||||
let list = this.couponList;
|
||||
if (res.data.is_exist == 1 && res.code < 0) {
|
||||
msg = '您已领取过该优惠券,快去使用吧';
|
||||
msg = this.$lang('goods.couponAlreadyClaimed');
|
||||
} else if (res.code == 0) {
|
||||
msg = '领取成功,快去使用吧';
|
||||
msg = this.$lang('goods.couponClaimSuccess');
|
||||
} else {
|
||||
msg = res.message;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ export default {
|
||||
fontWeight: false,
|
||||
padding: 0,
|
||||
cartEvent: "detail",
|
||||
text: "购买",
|
||||
text: this.$lang('goods.buy'),
|
||||
textColor: "#FFFFFF",
|
||||
theme: "default",
|
||||
aroundRadius: 25,
|
||||
@@ -75,7 +75,7 @@ export default {
|
||||
if(this.langstatus == 1){
|
||||
// this.$langConfig.refresh();
|
||||
uni.setNavigationBarTitle({
|
||||
title:uni.getStorageSync('lang') == 'en-us'?'Goods List':'商品列表'
|
||||
title: this.$lang('goods.goodsList')
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ export default {
|
||||
* 转发分享
|
||||
*/
|
||||
onShareAppMessage(res) {
|
||||
var title = '搜索到' + this.count + '件“' + this.keyword + this.category_title + this.coupon_name + '”相关的优质商品';
|
||||
var title = this.$lang('goods.searchResultCount', { count: this.count, keyword: this.keyword + this.category_title + this.coupon_name });'”相关的优质商品';
|
||||
let route = this.$util.getCurrentShareRoute(this.memberInfo ? this.memberInfo.member_id : 0);
|
||||
var path = route.path;
|
||||
return {
|
||||
@@ -137,7 +137,7 @@ export default {
|
||||
},
|
||||
// 分享到微信朋友圈
|
||||
onShareTimeline() {
|
||||
var title = '搜索到' + this.count + '件“' + this.keyword + this.category_title + this.coupon_name + '”相关的优质商品';
|
||||
var title = this.$lang('goods.searchResultCount', { count: this.count, keyword: this.keyword + this.category_title + this.coupon_name });'”相关的优质商品';
|
||||
let route = this.$util.getCurrentShareRoute(this.memberInfo ? this.memberInfo.member_id : 0);
|
||||
var query = route.query;
|
||||
return {
|
||||
@@ -362,26 +362,26 @@ export default {
|
||||
// }
|
||||
if (!Number(this.maxPrice) && this.maxPrice) {
|
||||
this.$util.showToast({
|
||||
title: '请输入最高价'
|
||||
title: this.$lang('goods.inputMaxPrice')
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (Number(this.minPrice) < 0 || Number(this.maxPrice) < 0) {
|
||||
this.$util.showToast({
|
||||
title: '筛选价格不能小于0'
|
||||
title: this.$lang('goods.priceNotNegative')
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.minPrice != '' && Number(this.minPrice) > Number(this.maxPrice) && this.maxPrice) {
|
||||
|
||||
this.$util.showToast({
|
||||
title: '最低价不能大于最高价'
|
||||
title: this.$lang('goods.minNotGreaterMax')
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.maxPrice != '' && Number(this.maxPrice) < Number(this.minPrice)) {
|
||||
this.$util.showToast({
|
||||
title: '最高价不能小于最低价'
|
||||
title: this.$lang('goods.maxNotLessMin')
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user