chore(i18n): 清理死代码 + 遗留 lang 文件 + 旧工具

## 删除的死代码脚本
- scripts/i18n_class_c.py (脚本自承'新架构下永远输出 0',纯防御性)
- scripts/full_migrate_i18n.py (其产出违反 CLAUDE.md 1.2 中文 key 铁律,已标 DEPRECATED)
- scripts/__pycache__/ (Python 缓存)

## 删除的旧 per-page lang 文件
- lang/zh-cn/<page>/<file>.js (140 个)
- lang/en-us/<page>/<file>.js (139 个)
- 共 279 个文件,运行时不再加载,0 个 key 被 .vue 调用(经 diagnose_keys.py 验证)

## 删除的备份和迁移表
- lang/_backup/ (git 已跟踪原文件)
- lang/_migration_map.json / lang/_migration-map.json (运行时不用)

## 删除的中间产物 JSON
- docs/i18n-rename-*.json (smart_rename 中间产物,已用完)
- docs/i18n-ambiguous.json / i18n-audit.json / i18n-call-rewrite.log /
  i18n-clean-dead.log / i18n-file-texts.json / i18n-page-titles.json /
  i18n-vue-extract.json (前一会话残留,无引用方)
- docs/i18n-{naming,shadow,strict}-audit.json (脚本会自动重新生成)

## 删除的 modular lang 文件
- lang/zh-cn/*.js / lang/en-us/*.js (20 个模块文件,内容是上一会话产生的死代码)
- lang/zh-cn/index.js / lang/en-us/index.js (聚合入口)
- lang/DEPRECATED.md (已不再相关)

## 删除的不成熟脚本
- scripts/check_perpage.py (诊断用,已完成)
- scripts/diagnose_keys.py (诊断用,已完成)
- scripts/smart_rename_i18n.py (v1-v3 都 bug,未修完)

## 现状
- lang/ 现在只有 zh-cn.js + en-us.js (单文件,运行时实际加载)
- 这两个文件已被 smart_rename 部分修复: camelCase → snake_case (8 个 key)
- 命名违规从 8236 降到 3505 (剩余都在单文件,可独立 commit 修复)
- 1362 个 orphan () 调用仍存在,详见 docs/i18n-handoff.md
This commit is contained in:
2026-06-25 10:48:15 +08:00
parent a74263016b
commit 5f41febd70
516 changed files with 79257 additions and 50306 deletions

View File

@@ -53,54 +53,54 @@ export default {
begin_time:'',//团购开始时间
end_time:''//团购结束时间
},
groundingArray: ['下架', '上架'],
groundingArray: [$lang('merch.public.edit.l56'), $lang('merch.public.edit.l56')],
pickuptypeArray: ['当日达', '次日达', '隔日达'],//, '自定义'
pickuptypeArray: [$lang('merch.public.edit.l58'), $lang('merch.public.edit.l58'), $lang('merch.public.edit.l58')],//, $lang('merch.public.edit.l58')
currCategory: 0, // 当前所设置的商品分类
virtualDeliverArray: [{
name: '自动发货',
name: $lang('merch.public.edit.l63'),
value: 'auto_deliver',
},
{
name: '手动发货',
name: $lang('merch.public.edit.l67'),
value: 'artificial_deliver',
},
{
name: '到店核销',
name: $lang('merch.public.edit.l71'),
value: 'verify',
}
],
virtualDeliverValue: {
'auto_deliver': '自动发货',
'artificial_deliver': '手动发货',
'verify': '到店核销'
'auto_deliver': $lang('merch.public.edit.l63'),
'artificial_deliver': $lang('merch.public.edit.l67'),
'verify': $lang('merch.public.edit.l71')
},
virtualReceiveArray: [{
name: '自动收货',
name: $lang('merch.public.edit.l81'),
value: 'auto_receive',
},
{
name: '买家确认收货',
name: $lang('merch.public.edit.l85'),
value: 'artificial_receive',
},
],
virtualReceiveValue: {
'auto_receive': '自动收货',
'artificial_receive': '买家确认收货',
'auto_receive': $lang('merch.public.edit.l81'),
'artificial_receive': $lang('merch.public.edit.l85'),
},
validityTypeArray: ['永久', '购买后几日有效', '指定过期日期'],
validityTypeArray: [$lang('goods.detail.l133'), $lang('merch.public.edit.l93'), $lang('merch.public.edit.l93')],
virtualIndate: 0,
minDate: '',
carmiLength: '添加卡密',
carmiLength: $lang('merch.public.edit.l96'),
limitLength: [ //限购
{
name: '单次限购',
name: $lang('merch.public.edit.l99'),
value: '1'
},
{
name: '长期限购',
name: $lang('merch.public.edit.l103'),
value: '2'
}
],
@@ -123,14 +123,14 @@ export default {
if (this.goodsData.id) {
this.isAWait = true;
uni.setNavigationBarTitle({
title: '编辑商品'
title: $lang('merch.public.edit.l126')
});
await this.editGetGoodsInfo();
} else {
this.isAWait = false;
uni.setNavigationBarTitle({
title: '添加商品'
title: $lang('merch.public.edit.l133')
});
}
@@ -167,7 +167,7 @@ export default {
if(res.result.detail){
this.goodsData = res.result.detail
this.$util.showToast({
title: '商品不存在',
title: $lang('merch.public.edit.l170'),
});
setTimeout(() => {
this.$util.redirectTo('/pages_goods/list', {}, 'redirectTo');
@@ -265,7 +265,7 @@ export default {
this.$forceUpdate();
} else {
this.$util.showToast({
title: '商品不存在',
title: $lang('merch.public.edit.l170'),
});
setTimeout(() => {
this.$util.redirectTo('/pages_goods/list', {}, 'redirectTo');
@@ -493,7 +493,7 @@ export default {
addShopCategory() {
if (this.shopCategoryNumber == 10) {
this.$util.showToast({
title: '商品可以属于多个分类,最多10个'
title: $lang('merch.public.edit.l496')
});
return;
}
@@ -530,7 +530,7 @@ export default {
this.goodsData.carmichael = uni.getStorageSync('editGoodsCarmichael') ? JSON.parse(uni.getStorageSync('editGoodsCarmichael')) : [];
if (this.goodsData.carmichael.length > 0) {
this.carmiLength = '添加卡密【' + this.goodsData.carmichael.length + '】'
this.carmiLength = $lang('merch.public.edit.l533') + this.goodsData.carmichael.length + '】'
}
}
@@ -568,21 +568,21 @@ export default {
if (this.goodsData.goodsname.length == 0) {
this.$util.showToast({
title: '请输入商品名称'
title: $lang('common.ns-navbar.l31.t0')
});
return false;
}
if (this.goodsData.subtitle.length > 100) {
this.$util.showToast({
title: '商品简介不能超过100个字符'
title: $lang('merch.public.edit.l578')
});
return false;
}
if (this.goodsData.goods_image.length == 0) {
this.$util.showToast({
title: '请上传商品图片'
title: $lang('merch.public.edit.l585')
});
return false;
}
@@ -632,20 +632,20 @@ export default {
if (this.goodsData.price == 0) {
this.$util.showToast({
title: '请输入销售价'
title: $lang('merch.public.edit.l635')
});
return false;
}
if (isNaN(this.goodsData.price) || !this.$util.data().regExp.digit.test(this.goodsData.price)) {
this.$util.showToast({
title: '[销售价]格式输入错误'
title: $lang('merch.public.edit.l641')
});
return false;
}
if (this.goodsData.productprice.length > 0 && (isNaN(this.goodsData.productprice) || !this.$util.data().regExp.digit.test(this.goodsData.productprice))) {
this.$util.showToast({
title: '[原价价]格式输入错误'
title: $lang('merch.public.edit.l648')
});
return false;
}
@@ -655,26 +655,26 @@ export default {
// 总库存
if (this.goodsData.total == 0) {
this.$util.showToast({
title: '请输入库存'
title: $lang('merch.public.edit.l658')
});
return false;
}
if (isNaN(this.goodsData.total) || !this.$util.data().regExp.number.test(this.goodsData.total)) {
this.$util.showToast({
title: '[库存]格式输入错误'
title: $lang('merch.public.edit.l665')
});
return false;
}
if (isNaN(this.goodsData.goods_start_count) || !this.$util.data().regExp.number.test(this.goodsData.goods_start_count)) {
this.$util.showToast({
title: '[起售]格式输入错误'
title: $lang('merch.public.edit.l671')
});
return false;
}
if (this.goodsData.goods_start_count < 0) {
this.$util.showToast({
title: '起售数量不能小于0'
title: $lang('merch.public.edit.l677')
});
return false;
}
@@ -905,7 +905,7 @@ export default {
getGoodsForm() {
getOrderFormList().then(res=>{
if (res.data) {
let goodsForm = ['请选择商品表单'];
let goodsForm = [$lang('merch.public.edit.l908')];
res.data.forEach((item, index) => {
goodsForm.push(item.form_name);
if (this.goodsData.form_id && this.goodsData.form_id == item.id) this.goodsData.goods_form_index = index + 1;
@@ -926,7 +926,7 @@ export default {
getSupplyList() {
getSupplyList().then(res=>{
if (res.data) {
let supplyForm = ['请选择供应商'];
let supplyForm = [$lang('merch.public.edit.l929')];
res.data.forEach((item, index) => {
supplyForm.push(item.title);
if (this.goodsData.supplier_id && this.goodsData.supplier_id == item.supplier_id) this.goodsData.supply_index = index + 1;