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

@@ -147,7 +147,7 @@
<view class="fui-cell-info">
<input id="input-realname" :value="Form.realname"
@input="e => Form.realname = e.detail.value" class="fui-input"
:placeholder="$lang('pleaseEnterName')" :key="formKey" />
:placeholder="$lang('contact.contact.pleaseEnterName')" :key="formKey" />
</view>
</view>
<view class="fui-cell ">
@@ -155,7 +155,7 @@
<view class="fui-cell-info">
<input id="input-mobile" :value="Form.mobile"
@input="e => Form.mobile = e.detail.value" class="fui-input" maxlength="11"
:placeholder="$lang('pleaseEnterMobile')" type="number" :key="formKey" />
:placeholder="$lang('contact.contact.pleaseEnterMobile')" type="number" :key="formKey" />
</view>
</view>
<view class="fui-cell ">
@@ -165,7 +165,7 @@
<!-- <input v-model="Form.mailbox" class="fui-input" placeholder="请输入您的邮箱" type="text" ></input> -->
<textarea id="textarea-remark" :value="Form.remark"
@input="e => Form.remark = e.detail.value" class="textarea"
:placeholder="$lang('pleaseEnterMessage')"
:placeholder="$lang('contact.contact.pleaseEnterMessage')"
style="font-size: 28rpx;padding: 10rpx;" :key="formKey"></textarea>
</view>
</view>
@@ -311,11 +311,11 @@ export default {
// 如果后台没配置,用默认值
this.mpShareData = {
appMessage: {
title: this.$lang('contactUs'),
title: this.$lang('contact.contact.contactUs'),
path: '/pages_tool/contact/contact'
},
timeLine: {
title: this.$lang('contactUs'),
title: this.$lang('contact.contact.contactUs'),
query: ''
}
};
@@ -351,7 +351,7 @@ export default {
this.currentVideo = video;
this.$refs.videoPlayerPopup.open();
} else {
uni.showToast({ title: this.$lang('videoUrlNotExist'), icon: 'none' });
uni.showToast({ title: this.$lang('contact.contact.videoUrlNotExist'), icon: 'none' });
}
},
@@ -369,22 +369,22 @@ export default {
},
save() {
if (!this.Form.realname.trim()) {
uni.showToast({ title: this.$lang('pleaseFillName'), icon: 'none' });
uni.showToast({ title: this.$lang('contact.contact.pleaseFillName'), icon: 'none' });
return;
}
if (!this.Form.mobile || !/^1[3-9]\d{9}$/.test(this.Form.mobile)) {
uni.showToast({ title: this.$lang('invalidMobileFormat'), icon: 'none' });
uni.showToast({ title: this.$lang('contact.contact.invalidMobileFormat'), icon: 'none' });
return;
}
if (!this.Form.remark.trim()) {
uni.showToast({ title: this.$lang('pleaseFillMessage'), icon: 'none' });
uni.showToast({ title: this.$lang('contact.contact.pleaseFillMessage'), icon: 'none' });
return;
}
this.$api.sendRequest({
url: '/api/member/message',
data: this.Form,
success: res => {
uni.showToast({ title: res.message || this.$lang('submitSuccess'), icon: 'success' });
uni.showToast({ title: res.message || this.$lang('contact.contact.submitSuccess'), icon: 'success' });
// 重置表单数据
@@ -402,7 +402,7 @@ export default {
// #endif
},
fail: () => {
uni.showToast({ title: this.$lang('submitFailed'), icon: 'none' });
uni.showToast({ title: this.$lang('contact.contact.submitFailed'), icon: 'none' });
}
});
},
@@ -459,31 +459,31 @@ export default {
},
copy(text) {
copyText(text, { copySuccess: this.$lang('copySuccess'), copyFailed: this.$lang('copyFailed') });
copyText(text, { copySuccess: this.$lang('contact.contact.copySuccess'), copyFailed: this.$lang('contact.contact.copyFailed') });
},
tomap() {
openLocation({
latitude: parseFloat(this.shop.latitude),
longitude: parseFloat(this.shop.longitude),
name: this.$lang('oneClickNavigation'),
name: this.$lang('contact.contact.oneClickNavigation'),
});
},
onShareAppMessage() {
return this.mpShareData?.appMessage || {
title: this.$lang('contactUs'),
title: this.$lang('contact.contact.contactUs'),
path: '/pages_tool/contact/contact'
};
},
onShareTimeline() {
return this.mpShareData?.timeLine || {
title: this.$lang('contactUs'),
title: this.$lang('contact.contact.contactUs'),
query: ''
};
},
onAddToFavorites() {
return {
title: this.$lang('contactUs'),
title: this.$lang('contact.contact.contactUs'),
path: '/pages_tool/contact/contact'
};
},