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

@@ -13,14 +13,14 @@
<uni-popup ref="confirmPopup" type="center">
<view class="confirm-popup">
<view class="popup-header">
<text>添加企业微信客服</text>
<text>{{ $lang("common.wxwork-contact.l16.t0") }}</text>
</view>
<view class="popup-body">
<text>点击确定后将跳转至企业微信,添加专业客服为您服务</text>
<text>{{ $lang("common.wxwork-contact.l19.t0") }}</text>
</view>
<view class="popup-footer">
<button class="cancel-btn" @click="closePopup">取消</button>
<button class="confirm-btn" @click="confirmAdd">确定</button>
<button class="cancel-btn" @click="closePopup">{{ $lang("common.pick-regions.l17.t0") }}</button>
<button class="confirm-btn" @click="confirmAdd">{{ $lang("common.ns-goods-sku.ns-goods-sku-category.l76.t0") }}</button>
</view>
</view>
</uni-popup>
@@ -36,7 +36,7 @@
// 按钮文字
btnText: {
type: String,
default: '添加企业微信客服'
default: $lang('common.wxwork-contact.l16.t0')
},
// 企业ID(必需)
corpId: {
@@ -105,11 +105,11 @@
});
if (!initResult) {
console.error('企业微信SDK初始化失败');
console.error($lang('common.wxwork-contact.l108.t0'));
}
}
} catch (error) {
console.error('初始化企业微信SDK失败:', error);
console.error($lang('common.wxwork-contact.l112.t0'), error);
}
},
@@ -142,7 +142,7 @@
// 方案2:使用SDK打开用户资料
this.openUserProfile(contactId);
} else {
this.showError('未配置企业微信客服信息');
this.showError($lang('common.wxwork-contact.l145.t0'));
}
// #endif
@@ -151,7 +151,7 @@
// H5环境直接跳转
window.location.href = contactUrl;
} else {
this.showError('未配置企业微信客服信息');
this.showError($lang('common.wxwork-contact.l145.t0'));
}
// #endif
},
@@ -165,13 +165,13 @@
path: `pages/contacts/externalContactDetail?url=${encodeURIComponent(contactUrl)}`,
success: () => {
this.$util.showToast({
title: '跳转成功',
title: $lang('common.wxwork-contact.l168.t0'),
icon: 'success'
});
},
fail: (err) => {
console.error('跳转企业微信失败:', err);
this.showError('跳转失败,请检查企业微信配置');
console.error($lang('common.wxwork-contact.l173.t0'), err);
this.showError($lang('common.wxwork-contact.l174.t0'));
}
});
},
@@ -181,7 +181,7 @@
*/
openUserProfile(contactId) {
if (!this.wxWorkSDK) {
this.showError('企业微信SDK未初始化');
this.showError($lang('common.wxwork-contact.l184.t0'));
return;
}
@@ -189,8 +189,8 @@
userId: contactId
}, (res) => {
}, (err) => {
console.error('打开用户资料失败:', err);
this.showError('打开用户资料失败');
console.error($lang('common.wxwork-contact.l192.t0'), err);
this.showError($lang('common.wxwork-contact.l193.t0'));
});
},
@@ -199,7 +199,7 @@
*/
showError(message) {
uni.showModal({
title: '提示',
title: $lang('common.wxwork-contact.l202.t0'),
content: message,
showCancel: false
});