feat: 新增多语言文案与组件国际化适配
本次提交完成了大量多语言相关的新增与优化工作: 1. 新增充值、案例、会员资产、订单等页面的中文/英文翻译文案 2. 新增企业微信客服、时间选择、支付弹窗等组件的多语言包 3. 优化工具函数与自定义页面的多语言适配,替换硬编码提示文案 4. 新增会员等级规则、积分商品、退款管理等页面的国际化支持 5. 修复企业微信JS-SDK的错误提示文案硬编码问题
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import lang from '@/common/js/lang.js';
|
||||
|
||||
// 微信视频号组件配置
|
||||
export const wechatChannelConfig = {
|
||||
// 图标相关
|
||||
@@ -56,10 +58,10 @@ export const wechatChannelConfig = {
|
||||
|
||||
// 错误提示配置
|
||||
error: {
|
||||
notWechat: '当前环境不是微信小程序',
|
||||
lowVersion: '当前微信基础库版本过低,需要 2.19.2 或以上版本',
|
||||
notSupported: '当前环境不支持微信视频号',
|
||||
missingFields: '缺少必要字段: {field}',
|
||||
notWechat: 'wechatChannel.notWechat',
|
||||
lowVersion: 'wechatChannel.lowVersion',
|
||||
notSupported: 'wechatChannel.notSupported',
|
||||
missingFields: 'wechatChannel.missingFields',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -108,7 +110,7 @@ export const wechatChannelUtil = {
|
||||
const requiredFields = ['feedId', 'finderUserName'];
|
||||
for (const field of requiredFields) {
|
||||
if (!item[field]) {
|
||||
throw new Error(`缺少必要字段: ${field}`);
|
||||
throw new Error(lang.lang(wechatChannelConfig.error.missingFields, { field }));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -128,7 +130,7 @@ export const wechatChannelUtil = {
|
||||
|
||||
// 检查微信环境
|
||||
if (typeof wx === 'undefined') {
|
||||
const err = new Error(wechatChannelConfig.error.notWechat);
|
||||
const err = new Error(lang.lang(wechatChannelConfig.error.notWechat));
|
||||
this.handleError(err, item);
|
||||
reject(err);
|
||||
return;
|
||||
@@ -138,7 +140,7 @@ export const wechatChannelUtil = {
|
||||
const systemInfo = wx.getSystemInfoSync();
|
||||
const SDKVersion = systemInfo.SDKVersion;
|
||||
if (this.versionCompare(SDKVersion, wechatChannelConfig.wechat.minSdkVersion) < 0) {
|
||||
const err = new Error(wechatChannelConfig.error.lowVersion);
|
||||
const err = new Error(lang.lang(wechatChannelConfig.error.lowVersion));
|
||||
this.handleError(err, item);
|
||||
reject(err);
|
||||
return;
|
||||
@@ -158,7 +160,7 @@ export const wechatChannelUtil = {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
const err = new Error(wechatChannelConfig.error.notSupported);
|
||||
const err = new Error(lang.lang(wechatChannelConfig.error.notSupported));
|
||||
this.handleError(err, item);
|
||||
reject(err);
|
||||
}
|
||||
@@ -168,7 +170,7 @@ export const wechatChannelUtil = {
|
||||
// 统一错误处理
|
||||
handleError(err, item) {
|
||||
console.error('微信视频号错误:', err);
|
||||
const { message = '', errMsg = '微信视频播放失败!', errCode = -1 } = err;
|
||||
const { message = '', errMsg = lang.lang('wechatChannel.playFailed'), errCode = -1 } = err;
|
||||
|
||||
// 错误码5: 表示用户点击了取消. openChannelsActivity:fail cancel
|
||||
if ([5].includes(errCode)) {
|
||||
|
||||
Reference in New Issue
Block a user