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

@@ -3,7 +3,7 @@
<view class="avatar-selector-mask" @click="close"></view>
<view class="avatar-selector-panel">
<view class="avatar-selector-header">
<text>{{ $lang('avatarSelectorTitle') }}</text>
<text>{{ $lang('common.list.avatar_selector_title') }}</text>
<button class="close-btn" @click="close">
<text class="iconfont icon-close"></text>
</button>
@@ -15,10 +15,10 @@
<view class="avatar-selector-actions">
<button class="avatar-select-action" @click="chooseAvatarFromAlbum">
<text class="iconfont icon-album"></text>
<text>{{ $lang('chooseFromAlbum') }}</text>
<text>{{ $lang('common.list.choose_from_album') }}</text>
</button>
<button class="avatar-select-action cancel" @click="close">
<text>{{ $lang('cancel') }}</text>
<text>{{ $lang('common.button.cancel') }}</text>
</button>
</view>
</view>

View File

@@ -3,7 +3,7 @@
<view class="emoji-mask" @click="hideEmojiPanel"></view>
<view class="emoji-panel">
<view class="emoji-header">
<text>{{ $lang('emojiTitle') }}</text>
<text>{{ $lang('common.list.emoji_title') }}</text>
<button class="close-btn" @click="hideEmojiPanel">
<text>×</text>
</button>

View File

@@ -3,7 +3,7 @@
<view class="nickname-editor-mask" @click="close"></view>
<view class="nickname-editor-panel">
<view class="nickname-editor-header">
<text>{{ $lang('editNickname') }}</text>
<text>{{ $lang('common.list.edit_nickname') }}</text>
<button class="close-btn" @click="close">
<text class="iconfont icon-close"></text>
</button>
@@ -13,21 +13,21 @@
<input
v-model="tempNickname"
class="nickname-input"
:placeholder="$lang('newNicknamePlaceholder')"
:placeholder="$lang('common.list.new_nickname_placeholder')"
:maxlength="12"
type="text" />
</view>
<view class="nickname-tip">{{ $lang('nicknameTip') }}</view>
<view class="nickname-tip">{{ $lang('common.list.nickname_tip') }}</view>
<view class="nickname-editor-actions">
<button class="nickname-action-btn cancel" @click="close">
<text>{{ $lang('cancel') }}</text>
<text>{{ $lang('common.button.cancel') }}</text>
</button>
<button
class="nickname-action-btn confirm"
:class="{ disabled: !tempNickname.trim() }"
:disabled="!tempNickname.trim()"
@click="saveNickname">
<text>{{ $lang('save') }}</text>
<text>{{ $lang('common.button.save') }}</text>
</button>
</view>
</view>
@@ -87,7 +87,7 @@ export default {
uni.setStorageSync('user_nickname', newNickname)
this.$emit('nickname-change', newNickname)
this.close()
uni.showToast({ title: this.$lang('nicknameChangeSuccess'), icon: 'success', duration: 1500 })
uni.showToast({ title: this.$lang('common.list.nickname_change_success'), icon: 'success', duration: 1500 })
}
}
}

View File

@@ -3,7 +3,7 @@
<!-- 搜索入口按钮(浮动在消息区右上角) -->
<view class="search-entrance" :class="{ 'icon-only': !showLabel }" v-if="!showSearchBar" @click="toggleSearch">
<text class="iconfont icon-sousuo search-entrance-icon"></text>
<text class="search-entrance-label" v-if="showLabel">{{ $lang('searchEntrance') }}</text>
<text class="search-entrance-label" v-if="showLabel">{{ $lang('common.placeholder.search') }}</text>
</view>
<!-- 搜索浮条 -->
@@ -14,7 +14,7 @@
<input
class="search-bar-input"
v-model="searchKeyword"
:placeholder="$lang('searchPlaceholder')"
:placeholder="$lang('common.placeholder.search')"
:focus="true"
@input="onSearchInput"
@confirm="doSearch" />
@@ -27,11 +27,11 @@
<text class="search-bar-nav" :class="{ disabled: searchResultIndex >= searchResults.length - 1 }" @click="scrollToNextResult">▼</text>
</view>
</view>
<text class="search-bar-close" @click="closeSearch">{{ $lang('searchClose') }}</text>
<text class="search-bar-close" @click="closeSearch">{{ $lang('goods.list.search_close') }}</text>
</view>
<view class="search-bar-status" v-if="searched && searchKeyword && searchResults.length === 0">
<text class="search-bar-status-icon">!</text>
<text class="search-bar-status-text">{{ $lang('noMatchResult') }}</text>
<text class="search-bar-status-text">{{ $lang('common.list.no_match_result') }}</text>
</view>
</view>
</view>
@@ -43,7 +43,7 @@
*
* Props:
* messages: Array - 原始消息列表
* showLabel: Boolean - (默认 true) 是否显示"搜索"文字;设为 false 则只显示搜索图标
* showLabel: Boolean - (默认 true) 是否显示$lang("diy.diy-search.l31.t0")文字;设为 false 则只显示搜索图标
*
* Events:
* scroll-to: (messageKey: string) => void - 请求父组件滚动到指定消息
@@ -187,7 +187,7 @@ export default {
if (idx >= 0) {
this.scrollToSearchResult(idx)
} else {
uni.showToast({ title: this.$lang('searchAtTop'), icon: 'none' })
uni.showToast({ title: this.$lang('goods.list.search_at_top'), icon: 'none' })
}
},
@@ -196,7 +196,7 @@ export default {
if (idx < this.searchResults.length) {
this.scrollToSearchResult(idx)
} else {
uni.showToast({ title: this.$lang('searchAtBottom'), icon: 'none' })
uni.showToast({ title: this.$lang('goods.list.search_at_bottom'), icon: 'none' })
}
},

View File

@@ -3,7 +3,7 @@
<view class="tools-mask" @click="hideToolsPanel"></view>
<view class="tools-panel">
<view class="tools-header">
<text>{{ $lang('moreFunctions') }}</text>
<text>{{ $lang('common.list.more_functions') }}</text>
<button class="close-btn" @click="hideToolsPanel">
<text class="iconfont icon-close"></text>
</button>
@@ -13,25 +13,25 @@
<view class="tool-icon">
<text class="iconfont icon-image"></text>
</view>
<text class="tool-text">{{ $lang('image') }}</text>
<text class="tool-text">{{ $lang('common.list.image') }}</text>
</view>
<view class="tool-item" @click="selectFile">
<view class="tool-icon">
<text class="iconfont icon-file"></text>
</view>
<text class="tool-text">{{ $lang('file') }}</text>
<text class="tool-text">{{ $lang('common.list.file') }}</text>
</view>
<view class="tool-item" @click="startRecord">
<view class="tool-icon">
<text class="iconfont icon-voice"></text>
</view>
<text class="tool-text">{{ $lang('voice') }}</text>
<text class="tool-text">{{ $lang('common.list.voice') }}</text>
</view>
<view class="tool-item" @click="selectLocation">
<view class="tool-icon">
<text class="iconfont icon-location"></text>
</view>
<text class="tool-text">{{ $lang('location') }}</text>
<text class="tool-text">{{ $lang('common.list.location') }}</text>
</view>
</view>
</view>

View File

@@ -3,7 +3,7 @@
<view class="voice-mask" @click="hideVoicePanel"></view>
<view class="voice-input-panel">
<view class="voice-header">
<text>{{ $lang('voiceInputTitle') }}</text>
<text>{{ $lang('common.list.voice_input_title') }}</text>
<button class="close-btn" @click="hideVoicePanel">
<text class="iconfont icon-close"></text>
</button>
@@ -16,7 +16,7 @@
class="wave-bar"
:style="{ animationDelay: (i * 0.1) + 's' }"></view>
</view>
<text class="voice-tip">{{ voiceInputing ? $lang('recordingTip') : $lang('startRecordTip') }}</text>
<text class="voice-tip">{{ voiceInputing ? $lang('common.list.recording_tip') : $lang('common.list.start_record_tip') }}</text>
</view>
<view class="voice-actions">
<button class="voice-btn" @click="toggleVoiceInput">
@@ -86,7 +86,7 @@ export default {
// 录音中,可扩展实时转文字
})
.catch(error => {
uni.showToast({ title: this.$lang('voiceInputFailed'), icon: 'none' })
uni.showToast({ title: this.$lang('common.list.voice_input_failed'), icon: 'none' })
this.voiceInputing = false
})
}