feat: add and optimize multilingual text resources

- add new language packs for multiple pages and components including category, cart, order, member center, distribution, etc.
- add Chinese and English translations for new features and UI text
- fix navigation service error message to use multilingual text
- update component templates to use dynamic language translation instead of hardcoded text
- adjust code indentation and formatting for consistency
This commit is contained in:
2026-06-26 13:49:26 +08:00
parent 66a579d48c
commit f7fb9f34f9
116 changed files with 1640 additions and 525 deletions

View File

@@ -2,6 +2,8 @@
* 将常用的Uniapp提供的函数,存放到这里,按需引用
*/
import lang from './lang.js';
/**
* 显示错误信息
@@ -18,7 +20,7 @@ const showError = (err, useModal = false) => {
});
} else {
uni.showModal({
title: '错误提示',
title: lang.lang('uniappUtils.errorTip'),
content,
showCancel: false,
})
@@ -51,7 +53,7 @@ export const copyTextAsync = (text, { copySuccess = '', copyFailed = '' } = {})
return new Promise((resolve, reject) => {
// 输入验证
if (!text && text !== '') {
const error = new Error('复制文本不能为空');
const error = new Error(lang.lang('uniappUtils.copyTextEmpty'));
showError(error);
reject(error);
return;
@@ -59,13 +61,13 @@ export const copyTextAsync = (text, { copySuccess = '', copyFailed = '' } = {})
// 超时监测
const timeoutId = setTimeout(() => {
let error = new Error('复制操作长时间无响应,请检查相关权限及配置是否正确');
let error = new Error(lang.lang('uniappUtils.copyTimeout'));
// #ifdef MP-WEIXIN
error = new Error([
'复制操作长时间无响应!',
'原因:',
'1.微信平台->用户隐私保护指引->"剪贴板"功能未添加或审核未通过;',
'2.微信平台对剪贴板API调用频率有限制'
lang.lang('uniappUtils.copyTimeoutTitle'),
lang.lang('uniappUtils.copyTimeoutReason'),
lang.lang('uniappUtils.wechatClipboardReason1'),
lang.lang('uniappUtils.wechatClipboardReason2')
].join('\r\n'));
// #endif
showError(error, true);
@@ -96,7 +98,7 @@ export const copyTextAsync = (text, { copySuccess = '', copyFailed = '' } = {})
clearTimeout(timeoutId);
try {
uni.showToast({
title: err.message || err.errMsg || copyFailed || '复制失败',
title: err.message || err.errMsg || copyFailed || lang.lang('uniappUtils.copyFailed'),
icon: 'none',
duration: 2000
});