feat(i18n): add Traditional Chinese (zh-TW) locale support (#116)

* feat(i18n): add zh-TW locale support (backend infrastructure)

- 新增 LanguageType.ZH_TW 枚舉值
- 擴展 _lang_to_locale() 映射支援 zh-TW
- 創建 zh_TW 翻譯檔案結構 (messages.po + game_configs.po)
Closes #114

* feat(i18n): add zh-TW locale support (translation completion)

完成繁體中文語言的完整翻譯工作:

## 後端翻譯
- 將 messages.po 和 game_configs.po 轉換為繁體中文
- 編譯生成對應的 .mo 檔案
- 使用 OpenCC 's2t' 轉換器進行簡繁轉換

## 前端翻譯
- 新增 zh-TW.json 語言檔案
- 更新 index.ts 註冊 zh-TW 語言
- 修正 UI 語言標籤為「繁體中文」

## 翻譯統計
- messages.po: 701 個 msgid(動態字串、戰鬥、奇遇等)
- game_configs.po: 2972 個 msgid(遊戲配置)
- zh-TW.json: 347 行(前端 UI)

* feat(i18n): add zh-TW optimizations and tests

## 可選優化 1:用語本地化
- 修正前端 UI 詞彙為台灣繁體習慣
- 主要修正項目:
  - 菜單 -> 選單
  - 設置 -> 設定
  - 加載 -> 載入
  - 保存 -> 儲存
  - 程序 -> 程式
  - 其他 UI 用語調整

## 可選優化 2:測試覆蓋
- 新增 test_i18n_zh_tw.py 測試檔案
- 涵蓋 13 個測試用例:
  - 語言枚舉驗證
  - 語言切換測試
  - 日期格式驗證
  - 動態翻譯測試
  - 境界/動作/情緒翻譯測試
  - 檔案完整性檢查
  - 翻譯覆蓋率驗證
  - 回退機制測試

## 測試結果
- 所有 13 個測試用例通過
- 翻譯覆蓋率 > 95%

* fix(i18n): add polib skip check to translation coverage test

* feat(i18n): add zh-TW column to glossary with Taiwan localization
This commit is contained in:
teps3105
2026-02-01 13:28:18 +08:00
committed by GitHub
parent c981aff863
commit f0b6b62de5
10 changed files with 6034 additions and 251 deletions

View File

@@ -1,250 +1,250 @@
chinese,english,category,subcategory,notes chinese,chinese_tw,english,category,subcategory,notes
练气,Qi Refinement,cultivation,realm,First realm - refining qi 练气,練氣,cultivation,realm,First realm - refining qi,
筑基,Foundation Establishment,cultivation,realm,Building the foundation 筑基,築基,cultivation,realm,Building the foundation,
金丹,Core Formation,cultivation,realm,Forming the golden core 金丹,金丹,cultivation,realm,Forming the golden core,
元婴,Nascent Soul,cultivation,realm,Nascent soul emerges 元婴,元嬰,cultivation,realm,Nascent soul emerges,
前期,Early Stage,cultivation,stage, 前期,前期,cultivation,stage,,
中期,Middle Stage,cultivation,stage, 中期,中期,cultivation,stage,,
后期,Late Stage,cultivation,stage, 后期,後期,cultivation,stage,,
普通,Normal,rarity,,Common items/traits 普通,普通,rarity,,Common items/traits,
稀有,Rare,rarity,,Uncommon items/traits 稀有,稀有,rarity,,Uncommon items/traits,
超稀有,Super Rare,rarity,,Rare items/traits 超稀有,超稀有,rarity,,Rare items/traits,
传说,Legendary,rarity,,Legendary items/traits 传说,傳說,rarity,,Legendary items/traits,
,Gold,element,, ,,element,,,
,Wood,element,, ,,element,,,
,Water,element,, ,,element,,,
,Fire,element,, ,,element,,,
,Earth,element,, ,,element,,,
,Ice,element,,Extended element ,,element,,Extended element,
,Wind,element,,Extended element ,,element,,Extended element,
,Dark,element,,Extended element ,,element,,Extended element,
,Thunder,element,,Also: Lightning ,,element,,Also: Lightning,
,Evil,element,,Dark arts attribute ,,element,,Dark arts attribute,
金灵根,Gold Spiritual Root,root,, 金灵根,金靈根,root,,,
木灵根,Wood Spiritual Root,root,, 木灵根,木靈根,root,,,
水灵根,Water Spiritual Root,root,, 水灵根,水靈根,root,,,
火灵根,Fire Spiritual Root,root,, 火灵根,火靈根,root,,,
土灵根,Earth Spiritual Root,root,, 土灵根,土靈根,root,,,
天灵根,Heavenly Spiritual Root,root,,Rare - all-element affinity 天灵根,天靈根,root,,Rare - all-element affinity,
雷灵根,Thunder Spiritual Root,root,, 雷灵根,雷靈根,root,,,
冰灵根,Ice Spiritual Root,root,, 冰灵根,冰靈根,root,,,
风灵根,Wind Spiritual Root,root,, 风灵根,風靈根,root,,,
暗灵根,Dark Spiritual Root,root,, 暗灵根,暗靈根,root,,,
,East,direction,, ,,direction,,,
,South,direction,, ,,direction,,,
西,West,direction,, 西,西,direction,,,
,North,direction,, ,,direction,,,
,Righteous,alignment,,Orthodox sects ,,alignment,,Orthodox sects,
中立,Neutral,alignment,, 中立,中立,alignment,,,
,Evil,alignment,,Demonic/Unorthodox ,,alignment,,Demonic/Unorthodox,
掌门,Sect Master,sect,rank,Also: Sect Leader 掌门,掌門,sect,rank,Also: Sect Leader,
长老,Elder,sect,rank, 长老,長老,sect,rank,,
内门弟子,Inner Disciple,sect,rank, 内门弟子,內門弟子,sect,rank,,
外门弟子,Outer Disciple,sect,rank, 外门弟子,外門弟子,sect,rank,,
弟子,Disciple,sect,rank,Generic 弟子,弟子,sect,rank,Generic,
生命恢复速率,HP Recovery Rate,effect,,extra_hp_recovery_rate 生命恢复速率,生命恢復速率,effect,,extra_hp_recovery_rate,
最大生命值,Max HP,effect,,extra_max_hp 最大生命值,最大生命值,effect,,extra_max_hp,
最大寿元,Max Lifespan,effect,,extra_max_lifespan 最大寿元,最大壽元,effect,,extra_max_lifespan,
兵器熟练度获取,Weapon Proficiency Gain,effect,,extra_weapon_proficiency_gain 兵器熟练度获取,兵器熟練度獲取,effect,,extra_weapon_proficiency_gain,
双修经验,Dual Cultivation Experience,effect,,extra_dual_cultivation_exp 双修经验,雙修經驗,effect,,extra_dual_cultivation_exp,
突破成功率,Breakthrough Success Rate,effect,,extra_breakthrough_success_rate 突破成功率,突破成功率,effect,,extra_breakthrough_success_rate,
奇遇概率,Fortune Probability,effect,,extra_fortune_probability 奇遇概率,奇遇概率,effect,,extra_fortune_probability,
霉运概率,Misfortune Probability,effect,,extra_misfortune_probability 霉运概率,黴運概率,effect,,extra_misfortune_probability,
采集获取材料,Harvest Material Bonus,effect,,extra_harvest_materials 采集获取材料,採集獲取材料,effect,,extra_harvest_materials,
狩猎获取材料,Hunt Material Bonus,effect,,extra_hunt_materials 狩猎获取材料,狩獵獲取材料,effect,,extra_hunt_materials,
挖矿获取材料,Mining Material Bonus,effect,,extra_mine_materials 挖矿获取材料,挖礦獲取材料,effect,,extra_mine_materials,
物品出售价格,Item Sell Price,effect,,extra_item_sell_price_multiplier 物品出售价格,物品出售價格,effect,,extra_item_sell_price_multiplier,
购买折扣,Purchase Discount,effect,,shop_buy_price_reduction 购买折扣,購買折扣,effect,,shop_buy_price_reduction,
兵器升级概率,Weapon Upgrade Chance,effect,,extra_weapon_upgrade_chance 兵器升级概率,兵器升級概率,effect,,extra_weapon_upgrade_chance,
搜刮收益,Plunder Multiplier,effect,,extra_plunder_multiplier 搜刮收益,搜刮收益,effect,,extra_plunder_multiplier,
捕捉灵兽成功率,Beast Capture Success Rate,effect,,extra_catch_success_rate 捕捉灵兽成功率,捕捉靈獸成功率,effect,,extra_catch_success_rate,
修炼经验,Cultivation Experience,effect,,extra_cultivate_exp 修炼经验,修煉經驗,effect,,extra_cultivate_exp,
战力点数,Combat Power Points,effect,,extra_battle_strength_points 战力点数,戰力點數,effect,,extra_battle_strength_points,
逃跑成功率,Escape Success Rate,effect,,extra_escape_success_rate 逃跑成功率,逃跑成功率,effect,,extra_escape_success_rate,
暗杀成功率,Assassination Success Rate,effect,,extra_assassinate_success_rate 暗杀成功率,暗殺成功率,effect,,extra_assassinate_success_rate,
感知范围,Observation Radius,effect,,extra_observation_radius 感知范围,感知範圍,effect,,extra_observation_radius,
移动步长,Movement Range,effect,,extra_move_step 移动步长,移動步長,effect,,extra_move_step,
特殊能力,Special Abilities,effect,,legal_actions 特殊能力,特殊能力,effect,,legal_actions,
伤害减免,Damage Reduction,effect,,damage_reduction 伤害减免,傷害減免,effect,,damage_reduction,
境界压制,Realm Suppression,effect,,realm_suppression_bonus 境界压制,境界壓制,effect,,realm_suppression_bonus,
修炼时长缩减,Cultivation Duration Reduction,effect,,cultivate_duration_reduction 修炼时长缩减,修煉時長縮減,effect,,cultivate_duration_reduction,
铸造成功率,Forging Success Rate,effect,,extra_cast_success_rate 铸造成功率,鑄造成功率,effect,,extra_cast_success_rate,
炼丹成功率,Alchemy Success Rate,effect,,extra_refine_success_rate 炼丹成功率,煉丹成功率,effect,,extra_refine_success_rate,
自愈效率,Self-Heal Efficiency,effect,,extra_self_heal_efficiency 自愈效率,自愈效率,effect,,extra_self_heal_efficiency,
道侣,Dao Companion,relation,,Cultivation partner/spouse 道侣,道侶,relation,,Cultivation partner/spouse,
师傅,Master,relation,,Teacher in cultivation 师傅,師傅,relation,,Teacher in cultivation,
徒弟,Disciple,relation,,Student of a master 徒弟,徒弟,relation,,Student of a master,
父母,Parent,relation,, 父母,父母,relation,,,
子女,Child,relation,, 子女,子女,relation,,,
父亲,Father,relation,, 父亲,父親,relation,,,
母亲,Mother,relation,, 母亲,母親,relation,,,
儿子,Son,relation,, 儿子,兒子,relation,,,
女儿,Daughter,relation,, 女儿,女兒,relation,,,
兄弟姐妹,Sibling,relation,, 兄弟姐妹,兄弟姐妹,relation,,,
哥哥,Elder Brother,relation,, 哥哥,哥哥,relation,,,
弟弟,Younger Brother,relation,, 弟弟,弟弟,relation,,,
姐姐,Elder Sister,relation,, 姐姐,姐姐,relation,,,
妹妹,Younger Sister,relation,, 妹妹,妹妹,relation,,,
朋友,Friend,relation,, 朋友,朋友,relation,,,
仇人,Enemy,relation,,Also: Foe 仇人,仇人,relation,,Also: Foe,
亲属,Kin,relation,,Extended family 亲属,親屬,relation,,Extended family,
上品,Superior Grade,grade,,Also: High-grade 上品,上品,grade,,Also: High-grade,
中品,Medium Grade,grade,,Also: Mid-grade 中品,中品,grade,,Also: Mid-grade,
下品,Inferior Grade,grade,,Also: Low-grade 下品,下品,grade,,Also: Low-grade,
,Sword,weapon,type, ,,weapon,type,,
,Saber,weapon,type,Also: Blade ,,weapon,type,Also: Blade,
,Spear,weapon,type, ,,weapon,type,,
,Staff,weapon,type, ,,weapon,type,,
,Fan,weapon,type, ,,weapon,type,,
,Whip,weapon,type, ,,weapon,type,,
,Zither,weapon,type,Musical weapon ,,weapon,type,Musical weapon,
,Flute,weapon,type,Musical weapon ,,weapon,type,Musical weapon,
暗器,Hidden Weapon,weapon,type, 暗器,暗器,weapon,type,,
破境丹,Breakthrough Pill,elixir,type,For breaking through bottlenecks 破境丹,破境丹,elixir,type,For breaking through bottlenecks,
延寿丹,Longevity Pill,elixir,type,Extends lifespan 延寿丹,延壽丹,elixir,type,Extends lifespan,
长生丹,Longevity Pill,elixir,type,Extends lifespan 长生丹,長生丹,elixir,type,Extends lifespan,
燃血丹,Blood Burning Pill,elixir,type,Temporary power boost 燃血丹,燃血丹,elixir,type,Temporary power boost,
疗伤丹,Healing Pill,elixir,type,Restores HP 疗伤丹,療傷丹,elixir,type,Restores HP,
回春丹,Rejuvenation Pill,elixir,type,Healing over time 回春丹,回春丹,elixir,type,Healing over time,
灵石,Spirit Stone,item,,Currency 灵石,靈石,item,,Currency,
丹药,Elixir,item,,Also: Pill - Medicine 丹药,丹藥,item,,Also: Pill - Medicine,
法宝,Artifact,item,,Magical treasure 法宝,法寶,item,,Magical treasure,
兵器,Weapon,item,, 兵器,兵器,item,,,
功法,Cultivation Technique,item,,Also: Art - Manual 功法,功法,item,,Also: Art - Manual,
辅助装备,Auxiliary Equipment,item,,Accessories 辅助装备,輔助裝備,item,,Accessories,
修炼,Cultivate,action,solo,Gain experience 修炼,修煉,action,solo,Gain experience,
突破,Breakthrough,action,solo,Advance realm 突破,突破,action,solo,Advance realm,
疗伤,Self Heal,action,solo,Recover HP 疗伤,療傷,action,solo,Recover HP,
采集,Harvest,action,solo,Gather plants 采集,採集,action,solo,Gather plants,
狩猎,Hunt,action,solo,Hunt animals 狩猎,狩獵,action,solo,Hunt animals,
挖矿,Mine,action,solo,Extract ore 挖矿,挖礦,action,solo,Extract ore,
炼丹,Refine Elixir,action,solo,Craft pills 炼丹,煉丹,action,solo,Craft pills,
铸造,Forge,action,solo,Craft equipment 铸造,鑄造,action,solo,Craft equipment,
温养兵器,Nurture Weapon,action,solo,Increase proficiency 温养兵器,溫養兵器,action,solo,Increase proficiency,
购买,Buy,action,solo,Purchase items 购买,購買,action,solo,Purchase items,
出售,Sell,action,solo,Sell items 出售,出售,action,solo,Sell items,
消遣,Play,action,solo,Relax 消遣,消遣,action,solo,Relax,
御兽,Tame Beast,action,solo,Capture spirit beast 御兽,御獸,action,solo,Capture spirit beast,
移动,Move,action,solo,Travel 移动,移動,action,solo,Travel,
移动到区域,Move to Region,action,solo,Travel to location 移动到区域,移動到區域,action,solo,Travel to location,
移动到角色,Move to Character,action,solo,Travel to person 移动到角色,移動到角色,action,solo,Travel to person,
移动探索,Explore,action,solo,Explore direction 移动探索,移動探索,action,solo,Explore direction,
离开区域,Leave Region,action,solo,Depart area 离开区域,離開區域,action,solo,Depart area,
远离角色,Move Away,action,solo,Distance from person 远离角色,遠離角色,action,solo,Distance from person,
帮助凡人,Aid Mortals,action,solo,Righteous action 帮助凡人,幫助凡人,action,solo,Righteous action,
搜刮凡人,Plunder Mortals,action,solo,Evil action 搜刮凡人,搜刮凡人,action,solo,Evil action,
吞噬凡人,Devour Mortals,action,solo,Consume souls 吞噬凡人,吞噬凡人,action,solo,Consume souls,
攀谈,Converse,action,mutual,Chat 攀谈,攀談,action,mutual,Chat,
交谈,Talk,action,mutual,Dialogue 交谈,交談,action,mutual,Dialogue,
切磋,Spar,action,mutual,Friendly combat 切磋,切磋,action,mutual,Friendly combat,
攻击,Attack,action,mutual,Initiate combat 攻击,攻擊,action,mutual,Initiate combat,
发起战斗,Initiate Battle,action,mutual,Start fight 发起战斗,發起戰鬥,action,mutual,Start fight,
暗杀,Assassinate,action,mutual,Stealth kill 暗杀,暗殺,action,mutual,Stealth kill,
逃离,Escape,action,mutual,Flee combat 逃离,逃離,action,mutual,Flee combat,
双修,Dual Cultivation,action,mutual,Partner cultivation 双修,雙修,action,mutual,Partner cultivation,
传道,Impart,action,mutual,Teach disciple 传道,傳道,action,mutual,Teach disciple,
赠送,Gift,action,mutual,Give items 赠送,贈送,action,mutual,Give items,
抢夺洞府,Seize Cave,action,mutual,Contest dwelling 抢夺洞府,搶奪洞府,action,mutual,Contest dwelling,
驱赶,Drive Away,action,mutual,Force to leave 驱赶,驅趕,action,mutual,Force to leave,
接受,Accept,action,feedback, 接受,接受,action,feedback,,
拒绝,Reject,action,feedback, 拒绝,拒絕,action,feedback,,
让步,Yield,action,feedback, 让步,讓步,action,feedback,,
试图远离,Try to Distance,action,feedback, 试图远离,試圖遠離,action,feedback,,
试图离开区域,Try to Leave Area,action,feedback, 试图离开区域,試圖離開區域,action,feedback,,
逃离,Flee,action,feedback, 逃离,逃離,action,feedback,,
战斗,Fight,action,feedback, 战斗,戰鬥,action,feedback,,
误入洞府,Stumbled into Cave Dwelling,event,fortune,Equipment 误入洞府,誤入洞府,event,fortune,Equipment,
巧捡神兵,Found Divine Weapon,event,fortune,Equipment 巧捡神兵,巧撿神兵,event,fortune,Equipment,
巧捡奇物,Found Treasure,event,fortune,Equipment 巧捡奇物,巧撿奇物,event,fortune,Equipment,
误入试炼,Entered Trial Ground,event,fortune,Equipment 误入试炼,誤入試煉,event,fortune,Equipment,
异象出世,Witnessed Strange Phenomenon,event,fortune,Equipment 异象出世,異象出世,event,fortune,Equipment,
高人赠予,Gift from Expert,event,fortune,Equipment 高人赠予,高人贈予,event,fortune,Equipment,
高人指点,Guidance from Expert,event,fortune,Technique 高人指点,高人指點,event,fortune,Technique,
玄妙感悟,Mystical Insight,event,fortune,Technique 玄妙感悟,玄妙感悟,event,fortune,Technique,
危难相救,Rescued from Danger,event,fortune,Find Master 危难相救,危難相救,event,fortune,Find Master,
品行打动,Impressed by Character,event,fortune,Find Master 品行打动,品行打動,event,fortune,Find Master,
展露天赋,Displayed Talent,event,fortune,Find Master 展露天赋,展露天賦,event,fortune,Find Master,
机缘巧合,Fateful Coincidence,event,fortune,Find Master 机缘巧合,機緣巧合,event,fortune,Find Master,
通过考验,Passed Trial,event,fortune,Find Master 通过考验,通過考驗,event,fortune,Find Master,
偶遇灵矿,Found Spirit Mine,event,fortune,Spirit Stones 偶遇灵矿,偶遇靈礦,event,fortune,Spirit Stones,
洞府遗财,Cave Dwelling Treasure,event,fortune,Spirit Stones 洞府遗财,洞府遺財,event,fortune,Spirit Stones,
击杀妖兽,Slew Monster,event,fortune,Spirit Stones 击杀妖兽,擊殺妖獸,event,fortune,Spirit Stones,
交易获利,Profitable Trade,event,fortune,Spirit Stones 交易获利,交易獲利,event,fortune,Spirit Stones,
赌石得宝,Won Stone Gambling,event,fortune,Spirit Stones 赌石得宝,賭石得寶,event,fortune,Spirit Stones,
拾遗藏宝,Found Hidden Treasure,event,fortune,Spirit Stones 拾遗藏宝,拾遺藏寶,event,fortune,Spirit Stones,
顿悟玄机,Sudden Enlightenment,event,fortune,Cultivation 顿悟玄机,頓悟玄機,event,fortune,Cultivation,
古碑感悟,Insight from Ancient Stele,event,fortune,Cultivation 古碑感悟,古碑感悟,event,fortune,Cultivation,
服食灵药,Consumed Spirit Medicine,event,fortune,Cultivation 服食灵药,服食靈藥,event,fortune,Cultivation,
秘境修炼,Cultivated in Secret Realm,event,fortune,Cultivation 秘境修炼,祕境修煉,event,fortune,Cultivation,
前辈灌顶,Empowerment from Senior,event,fortune,Cultivation 前辈灌顶,前輩灌頂,event,fortune,Cultivation,
灵泉淬体,Tempered by Spirit Spring,event,fortune,Cultivation 灵泉淬体,靈泉淬體,event,fortune,Cultivation,
传承记忆,Inherited Memory,event,fortune,Cultivation 传承记忆,傳承記憶,event,fortune,Cultivation,
遭遇扒手,Encountered Pickpocket,event,misfortune,Loss - Spirit stones 遭遇扒手,遭遇扒手,event,misfortune,Loss - Spirit stones,
误买假货,Bought Counterfeit Goods,event,misfortune,Loss - Spirit stones 误买假货,誤買假貨,event,misfortune,Loss - Spirit stones,
遭人勒索,Was Extorted,event,misfortune,Loss - Spirit stones 遭人勒索,遭人勒索,event,misfortune,Loss - Spirit stones,
洞府失窃,Cave Dwelling Robbed,event,misfortune,Loss - Spirit stones 洞府失窃,洞府失竊,event,misfortune,Loss - Spirit stones,
赌石惨败,Lost Stone Gambling,event,misfortune,Loss - Spirit stones 赌石惨败,賭石慘敗,event,misfortune,Loss - Spirit stones,
投资失败,Failed Investment,event,misfortune,Loss - Spirit stones 投资失败,投資失敗,event,misfortune,Loss - Spirit stones,
修炼岔气,Cultivation Deviation,event,misfortune,Injury - Qi went astray 修炼岔气,修煉岔氣,event,misfortune,Injury - Qi went astray,
出门摔伤,Fell and Got Injured,event,misfortune,Injury 出门摔伤,出門摔傷,event,misfortune,Injury,
妖兽偷袭,Ambushed by Beast,event,misfortune,Injury 妖兽偷袭,妖獸偷襲,event,misfortune,Injury,
仇家闷棍,Ambushed by Enemy,event,misfortune,Injury 仇家闷棍,仇家悶棍,event,misfortune,Injury,
误触机关,Triggered Trap,event,misfortune,Injury 误触机关,誤觸機關,event,misfortune,Injury,
天降横祸,Unexpected Disaster,event,misfortune,Injury 天降横祸,天降橫禍,event,misfortune,Injury,
心魔滋生,Heart Demon Arose,event,misfortune,Backlash 心魔滋生,心魔滋生,event,misfortune,Backlash,
灵气逆行,Qi Reversal,event,misfortune,Backlash 灵气逆行,靈氣逆行,event,misfortune,Backlash,
感悟错乱,Confused Insight,event,misfortune,Backlash 感悟错乱,感悟錯亂,event,misfortune,Backlash,
急火攻心,Overcome by Rage,event,misfortune,Backlash 急火攻心,急火攻心,event,misfortune,Backlash,
心魔,Heart Demon Tribulation,event,tribulation,Inner demon - self-doubt 心魔,心魔,event,tribulation,Inner demon - self-doubt,
雷劫,Thunder Tribulation,event,tribulation,Heavenly lightning 雷劫,雷劫,event,tribulation,Heavenly lightning,
肉身,Body Tribulation,event,tribulation,Physical transformation 肉身,肉身,event,tribulation,Physical transformation,
寻仇,Vengeance Tribulation,event,tribulation,Past enemies return 寻仇,尋仇,event,tribulation,Past enemies return,
情劫,Emotion Tribulation,event,tribulation,Love/attachment trial 情劫,情劫,event,tribulation,Love/attachment trial,
阳罡,Yang Force Tribulation,event,tribulation,Scorching yang energy 阳罡,陽罡,event,tribulation,Scorching yang energy,
雷火,Thunder-Fire Tribulation,event,tribulation,Combined lightning and fire 雷火,雷火,event,tribulation,Combined lightning and fire,
风灾,Wind Disaster Tribulation,event,tribulation,Violent tempest 风灾,風災,event,tribulation,Violent tempest,
阴狱,Yin Prison Tribulation,event,tribulation,Netherworld judgment 阴狱,陰獄,event,tribulation,Netherworld judgment,
魔劫,Demonic Tribulation,event,tribulation,Inner demons manifest 魔劫,魔劫,event,tribulation,Inner demons manifest,
老死,Died of Old Age,event,death,Lifespan exhausted 老死,老死,event,death,Lifespan exhausted,
战死,Died in Battle,event,death, 战死,戰死,event,death,,
重伤不治,Died from Severe Injuries,event,death, 重伤不治,重傷不治,event,death,,
平静,Calm,emotion,, 平静,平靜,emotion,,,
开心,Happy,emotion,, 开心,開心,emotion,,,
愤怒,Angry,emotion,, 愤怒,憤怒,emotion,,,
悲伤,Sad,emotion,, 悲伤,悲傷,emotion,,,
恐惧,Fearful,emotion,, 恐惧,恐懼,emotion,,,
惊讶,Surprised,emotion,, 惊讶,驚訝,emotion,,,
期待,Expectant,emotion,, 期待,期待,emotion,,,
厌恶,Disgusted,emotion,, 厌恶,厭惡,emotion,,,
疑惑,Confused,emotion,, 疑惑,疑惑,emotion,,,
疲惫,Exhausted,emotion,, 疲惫,疲憊,emotion,,,
系统菜单,System Menu,ui,, 系统菜单,系統選單,ui,,,
开始游戏,Start Game,ui,, 开始游戏,開始遊戲,ui,,,
加载游戏,Load Game,ui,, 加载游戏,載入遊戲,ui,,,
保存游戏,Save Game,ui,, 保存游戏,儲存遊戲,ui,,,
新建角色,Create Character,ui,, 新建角色,新建角色,ui,,,
删除角色,Delete Character,ui,, 删除角色,刪除角色,ui,,,
设置,Settings,ui,, 设置,設定,ui,,,
其他,Other,ui,, 其他,其他,ui,,,
境界,Realm,ui,, 境界,境界,ui,,,
年龄,Age,ui,, 年龄,年齡,ui,,,
性别,Gender,ui,, 性别,性別,ui,,,
,Male,ui,, ,,ui,,,
,Female,ui,, ,,ui,,,
宗门,Sect,ui,, 宗门,宗門,ui,,,
散修,Rogue Cultivator,ui,,Independent - no sect 散修,散修,ui,,Independent - no sect,
灵根,Spiritual Root,ui,, 灵根,靈根,ui,,,
灵石,Spirit Stones,ui,, 灵石,靈石,ui,,,
颜值,Appearance,ui,, 颜值,顏值,ui,,,
基础战力,Base Combat Power,ui,, 基础战力,基礎戰力,ui,,,
情绪,Emotion,ui,, 情绪,情緒,ui,,,
当前思考,Current Thoughts,ui,, 当前思考,當前思考,ui,,,
特质,Traits,ui,,Also: Persona 特质,特質,ui,,Also: Persona,
功法与装备,Techniques & Equipment,ui,, 功法与装备,功法與裝備,ui,,,
长期目标,Long-term Objective,ui,, 长期目标,長期目標,ui,,,
短期目标,Short-term Objective,ui,, 短期目标,短期目標,ui,,,
设定目标,Set Objective,ui,, 设定目标,設定目標,ui,,,
清空目标,Clear Objective,ui,, 清空目标,清空目標,ui,,,
语言,Language,ui,, 语言,語言,ui,,,
中文,Chinese,ui,, 中文,中文,ui,,,
英文,English,ui,, 英文,英文,ui,,,
1 chinese chinese_tw english category subcategory notes
2 练气 練氣 Qi Refinement cultivation cultivation realm realm First realm - refining qi First realm - refining qi
3 筑基 築基 Foundation Establishment cultivation cultivation realm realm Building the foundation Building the foundation
4 金丹 金丹 Core Formation cultivation cultivation realm realm Forming the golden core Forming the golden core
5 元婴 元嬰 Nascent Soul cultivation cultivation realm realm Nascent soul emerges Nascent soul emerges
6 前期 前期 Early Stage cultivation cultivation stage stage
7 中期 中期 Middle Stage cultivation cultivation stage stage
8 后期 後期 Late Stage cultivation cultivation stage stage
9 普通 普通 Normal rarity rarity Common items/traits Common items/traits
10 稀有 稀有 Rare rarity rarity Uncommon items/traits Uncommon items/traits
11 超稀有 超稀有 Super Rare rarity rarity Rare items/traits Rare items/traits
12 传说 傳說 Legendary rarity rarity Legendary items/traits Legendary items/traits
13 Gold element element
14 Wood element element
15 Water element element
16 Fire element element
17 Earth element element
18 Ice element element Extended element Extended element
19 Wind element element Extended element Extended element
20 Dark element element Extended element Extended element
21 Thunder element element Also: Lightning Also: Lightning
22 Evil element element Dark arts attribute Dark arts attribute
23 金灵根 金靈根 Gold Spiritual Root root root
24 木灵根 木靈根 Wood Spiritual Root root root
25 水灵根 水靈根 Water Spiritual Root root root
26 火灵根 火靈根 Fire Spiritual Root root root
27 土灵根 土靈根 Earth Spiritual Root root root
28 天灵根 天靈根 Heavenly Spiritual Root root root Rare - all-element affinity Rare - all-element affinity
29 雷灵根 雷靈根 Thunder Spiritual Root root root
30 冰灵根 冰靈根 Ice Spiritual Root root root
31 风灵根 風靈根 Wind Spiritual Root root root
32 暗灵根 暗靈根 Dark Spiritual Root root root
33 East direction direction
34 South direction direction
35 西 西 West direction direction
36 North direction direction
37 Righteous alignment alignment Orthodox sects Orthodox sects
38 中立 中立 Neutral alignment alignment
39 Evil alignment alignment Demonic/Unorthodox Demonic/Unorthodox
40 掌门 掌門 Sect Master sect sect rank rank Also: Sect Leader Also: Sect Leader
41 长老 長老 Elder sect sect rank rank
42 内门弟子 內門弟子 Inner Disciple sect sect rank rank
43 外门弟子 外門弟子 Outer Disciple sect sect rank rank
44 弟子 弟子 Disciple sect sect rank rank Generic Generic
45 生命恢复速率 生命恢復速率 HP Recovery Rate effect effect extra_hp_recovery_rate extra_hp_recovery_rate
46 最大生命值 最大生命值 Max HP effect effect extra_max_hp extra_max_hp
47 最大寿元 最大壽元 Max Lifespan effect effect extra_max_lifespan extra_max_lifespan
48 兵器熟练度获取 兵器熟練度獲取 Weapon Proficiency Gain effect effect extra_weapon_proficiency_gain extra_weapon_proficiency_gain
49 双修经验 雙修經驗 Dual Cultivation Experience effect effect extra_dual_cultivation_exp extra_dual_cultivation_exp
50 突破成功率 突破成功率 Breakthrough Success Rate effect effect extra_breakthrough_success_rate extra_breakthrough_success_rate
51 奇遇概率 奇遇概率 Fortune Probability effect effect extra_fortune_probability extra_fortune_probability
52 霉运概率 黴運概率 Misfortune Probability effect effect extra_misfortune_probability extra_misfortune_probability
53 采集获取材料 採集獲取材料 Harvest Material Bonus effect effect extra_harvest_materials extra_harvest_materials
54 狩猎获取材料 狩獵獲取材料 Hunt Material Bonus effect effect extra_hunt_materials extra_hunt_materials
55 挖矿获取材料 挖礦獲取材料 Mining Material Bonus effect effect extra_mine_materials extra_mine_materials
56 物品出售价格 物品出售價格 Item Sell Price effect effect extra_item_sell_price_multiplier extra_item_sell_price_multiplier
57 购买折扣 購買折扣 Purchase Discount effect effect shop_buy_price_reduction shop_buy_price_reduction
58 兵器升级概率 兵器升級概率 Weapon Upgrade Chance effect effect extra_weapon_upgrade_chance extra_weapon_upgrade_chance
59 搜刮收益 搜刮收益 Plunder Multiplier effect effect extra_plunder_multiplier extra_plunder_multiplier
60 捕捉灵兽成功率 捕捉靈獸成功率 Beast Capture Success Rate effect effect extra_catch_success_rate extra_catch_success_rate
61 修炼经验 修煉經驗 Cultivation Experience effect effect extra_cultivate_exp extra_cultivate_exp
62 战力点数 戰力點數 Combat Power Points effect effect extra_battle_strength_points extra_battle_strength_points
63 逃跑成功率 逃跑成功率 Escape Success Rate effect effect extra_escape_success_rate extra_escape_success_rate
64 暗杀成功率 暗殺成功率 Assassination Success Rate effect effect extra_assassinate_success_rate extra_assassinate_success_rate
65 感知范围 感知範圍 Observation Radius effect effect extra_observation_radius extra_observation_radius
66 移动步长 移動步長 Movement Range effect effect extra_move_step extra_move_step
67 特殊能力 特殊能力 Special Abilities effect effect legal_actions legal_actions
68 伤害减免 傷害減免 Damage Reduction effect effect damage_reduction damage_reduction
69 境界压制 境界壓制 Realm Suppression effect effect realm_suppression_bonus realm_suppression_bonus
70 修炼时长缩减 修煉時長縮減 Cultivation Duration Reduction effect effect cultivate_duration_reduction cultivate_duration_reduction
71 铸造成功率 鑄造成功率 Forging Success Rate effect effect extra_cast_success_rate extra_cast_success_rate
72 炼丹成功率 煉丹成功率 Alchemy Success Rate effect effect extra_refine_success_rate extra_refine_success_rate
73 自愈效率 自愈效率 Self-Heal Efficiency effect effect extra_self_heal_efficiency extra_self_heal_efficiency
74 道侣 道侶 Dao Companion relation relation Cultivation partner/spouse Cultivation partner/spouse
75 师傅 師傅 Master relation relation Teacher in cultivation Teacher in cultivation
76 徒弟 徒弟 Disciple relation relation Student of a master Student of a master
77 父母 父母 Parent relation relation
78 子女 子女 Child relation relation
79 父亲 父親 Father relation relation
80 母亲 母親 Mother relation relation
81 儿子 兒子 Son relation relation
82 女儿 女兒 Daughter relation relation
83 兄弟姐妹 兄弟姐妹 Sibling relation relation
84 哥哥 哥哥 Elder Brother relation relation
85 弟弟 弟弟 Younger Brother relation relation
86 姐姐 姐姐 Elder Sister relation relation
87 妹妹 妹妹 Younger Sister relation relation
88 朋友 朋友 Friend relation relation
89 仇人 仇人 Enemy relation relation Also: Foe Also: Foe
90 亲属 親屬 Kin relation relation Extended family Extended family
91 上品 上品 Superior Grade grade grade Also: High-grade Also: High-grade
92 中品 中品 Medium Grade grade grade Also: Mid-grade Also: Mid-grade
93 下品 下品 Inferior Grade grade grade Also: Low-grade Also: Low-grade
94 Sword weapon weapon type type
95 Saber weapon weapon type type Also: Blade Also: Blade
96 Spear weapon weapon type type
97 Staff weapon weapon type type
98 Fan weapon weapon type type
99 Whip weapon weapon type type
100 Zither weapon weapon type type Musical weapon Musical weapon
101 Flute weapon weapon type type Musical weapon Musical weapon
102 暗器 暗器 Hidden Weapon weapon weapon type type
103 破境丹 破境丹 Breakthrough Pill elixir elixir type type For breaking through bottlenecks For breaking through bottlenecks
104 延寿丹 延壽丹 Longevity Pill elixir elixir type type Extends lifespan Extends lifespan
105 长生丹 長生丹 Longevity Pill elixir elixir type type Extends lifespan Extends lifespan
106 燃血丹 燃血丹 Blood Burning Pill elixir elixir type type Temporary power boost Temporary power boost
107 疗伤丹 療傷丹 Healing Pill elixir elixir type type Restores HP Restores HP
108 回春丹 回春丹 Rejuvenation Pill elixir elixir type type Healing over time Healing over time
109 灵石 靈石 Spirit Stone item item Currency Currency
110 丹药 丹藥 Elixir item item Also: Pill - Medicine Also: Pill - Medicine
111 法宝 法寶 Artifact item item Magical treasure Magical treasure
112 兵器 兵器 Weapon item item
113 功法 功法 Cultivation Technique item item Also: Art - Manual Also: Art - Manual
114 辅助装备 輔助裝備 Auxiliary Equipment item item Accessories Accessories
115 修炼 修煉 Cultivate action action solo solo Gain experience Gain experience
116 突破 突破 Breakthrough action action solo solo Advance realm Advance realm
117 疗伤 療傷 Self Heal action action solo solo Recover HP Recover HP
118 采集 採集 Harvest action action solo solo Gather plants Gather plants
119 狩猎 狩獵 Hunt action action solo solo Hunt animals Hunt animals
120 挖矿 挖礦 Mine action action solo solo Extract ore Extract ore
121 炼丹 煉丹 Refine Elixir action action solo solo Craft pills Craft pills
122 铸造 鑄造 Forge action action solo solo Craft equipment Craft equipment
123 温养兵器 溫養兵器 Nurture Weapon action action solo solo Increase proficiency Increase proficiency
124 购买 購買 Buy action action solo solo Purchase items Purchase items
125 出售 出售 Sell action action solo solo Sell items Sell items
126 消遣 消遣 Play action action solo solo Relax Relax
127 御兽 御獸 Tame Beast action action solo solo Capture spirit beast Capture spirit beast
128 移动 移動 Move action action solo solo Travel Travel
129 移动到区域 移動到區域 Move to Region action action solo solo Travel to location Travel to location
130 移动到角色 移動到角色 Move to Character action action solo solo Travel to person Travel to person
131 移动探索 移動探索 Explore action action solo solo Explore direction Explore direction
132 离开区域 離開區域 Leave Region action action solo solo Depart area Depart area
133 远离角色 遠離角色 Move Away action action solo solo Distance from person Distance from person
134 帮助凡人 幫助凡人 Aid Mortals action action solo solo Righteous action Righteous action
135 搜刮凡人 搜刮凡人 Plunder Mortals action action solo solo Evil action Evil action
136 吞噬凡人 吞噬凡人 Devour Mortals action action solo solo Consume souls Consume souls
137 攀谈 攀談 Converse action action mutual mutual Chat Chat
138 交谈 交談 Talk action action mutual mutual Dialogue Dialogue
139 切磋 切磋 Spar action action mutual mutual Friendly combat Friendly combat
140 攻击 攻擊 Attack action action mutual mutual Initiate combat Initiate combat
141 发起战斗 發起戰鬥 Initiate Battle action action mutual mutual Start fight Start fight
142 暗杀 暗殺 Assassinate action action mutual mutual Stealth kill Stealth kill
143 逃离 逃離 Escape action action mutual mutual Flee combat Flee combat
144 双修 雙修 Dual Cultivation action action mutual mutual Partner cultivation Partner cultivation
145 传道 傳道 Impart action action mutual mutual Teach disciple Teach disciple
146 赠送 贈送 Gift action action mutual mutual Give items Give items
147 抢夺洞府 搶奪洞府 Seize Cave action action mutual mutual Contest dwelling Contest dwelling
148 驱赶 驅趕 Drive Away action action mutual mutual Force to leave Force to leave
149 接受 接受 Accept action action feedback feedback
150 拒绝 拒絕 Reject action action feedback feedback
151 让步 讓步 Yield action action feedback feedback
152 试图远离 試圖遠離 Try to Distance action action feedback feedback
153 试图离开区域 試圖離開區域 Try to Leave Area action action feedback feedback
154 逃离 逃離 Flee action action feedback feedback
155 战斗 戰鬥 Fight action action feedback feedback
156 误入洞府 誤入洞府 Stumbled into Cave Dwelling event event fortune fortune Equipment Equipment
157 巧捡神兵 巧撿神兵 Found Divine Weapon event event fortune fortune Equipment Equipment
158 巧捡奇物 巧撿奇物 Found Treasure event event fortune fortune Equipment Equipment
159 误入试炼 誤入試煉 Entered Trial Ground event event fortune fortune Equipment Equipment
160 异象出世 異象出世 Witnessed Strange Phenomenon event event fortune fortune Equipment Equipment
161 高人赠予 高人贈予 Gift from Expert event event fortune fortune Equipment Equipment
162 高人指点 高人指點 Guidance from Expert event event fortune fortune Technique Technique
163 玄妙感悟 玄妙感悟 Mystical Insight event event fortune fortune Technique Technique
164 危难相救 危難相救 Rescued from Danger event event fortune fortune Find Master Find Master
165 品行打动 品行打動 Impressed by Character event event fortune fortune Find Master Find Master
166 展露天赋 展露天賦 Displayed Talent event event fortune fortune Find Master Find Master
167 机缘巧合 機緣巧合 Fateful Coincidence event event fortune fortune Find Master Find Master
168 通过考验 通過考驗 Passed Trial event event fortune fortune Find Master Find Master
169 偶遇灵矿 偶遇靈礦 Found Spirit Mine event event fortune fortune Spirit Stones Spirit Stones
170 洞府遗财 洞府遺財 Cave Dwelling Treasure event event fortune fortune Spirit Stones Spirit Stones
171 击杀妖兽 擊殺妖獸 Slew Monster event event fortune fortune Spirit Stones Spirit Stones
172 交易获利 交易獲利 Profitable Trade event event fortune fortune Spirit Stones Spirit Stones
173 赌石得宝 賭石得寶 Won Stone Gambling event event fortune fortune Spirit Stones Spirit Stones
174 拾遗藏宝 拾遺藏寶 Found Hidden Treasure event event fortune fortune Spirit Stones Spirit Stones
175 顿悟玄机 頓悟玄機 Sudden Enlightenment event event fortune fortune Cultivation Cultivation
176 古碑感悟 古碑感悟 Insight from Ancient Stele event event fortune fortune Cultivation Cultivation
177 服食灵药 服食靈藥 Consumed Spirit Medicine event event fortune fortune Cultivation Cultivation
178 秘境修炼 祕境修煉 Cultivated in Secret Realm event event fortune fortune Cultivation Cultivation
179 前辈灌顶 前輩灌頂 Empowerment from Senior event event fortune fortune Cultivation Cultivation
180 灵泉淬体 靈泉淬體 Tempered by Spirit Spring event event fortune fortune Cultivation Cultivation
181 传承记忆 傳承記憶 Inherited Memory event event fortune fortune Cultivation Cultivation
182 遭遇扒手 遭遇扒手 Encountered Pickpocket event event misfortune misfortune Loss - Spirit stones Loss - Spirit stones
183 误买假货 誤買假貨 Bought Counterfeit Goods event event misfortune misfortune Loss - Spirit stones Loss - Spirit stones
184 遭人勒索 遭人勒索 Was Extorted event event misfortune misfortune Loss - Spirit stones Loss - Spirit stones
185 洞府失窃 洞府失竊 Cave Dwelling Robbed event event misfortune misfortune Loss - Spirit stones Loss - Spirit stones
186 赌石惨败 賭石慘敗 Lost Stone Gambling event event misfortune misfortune Loss - Spirit stones Loss - Spirit stones
187 投资失败 投資失敗 Failed Investment event event misfortune misfortune Loss - Spirit stones Loss - Spirit stones
188 修炼岔气 修煉岔氣 Cultivation Deviation event event misfortune misfortune Injury - Qi went astray Injury - Qi went astray
189 出门摔伤 出門摔傷 Fell and Got Injured event event misfortune misfortune Injury Injury
190 妖兽偷袭 妖獸偷襲 Ambushed by Beast event event misfortune misfortune Injury Injury
191 仇家闷棍 仇家悶棍 Ambushed by Enemy event event misfortune misfortune Injury Injury
192 误触机关 誤觸機關 Triggered Trap event event misfortune misfortune Injury Injury
193 天降横祸 天降橫禍 Unexpected Disaster event event misfortune misfortune Injury Injury
194 心魔滋生 心魔滋生 Heart Demon Arose event event misfortune misfortune Backlash Backlash
195 灵气逆行 靈氣逆行 Qi Reversal event event misfortune misfortune Backlash Backlash
196 感悟错乱 感悟錯亂 Confused Insight event event misfortune misfortune Backlash Backlash
197 急火攻心 急火攻心 Overcome by Rage event event misfortune misfortune Backlash Backlash
198 心魔 心魔 Heart Demon Tribulation event event tribulation tribulation Inner demon - self-doubt Inner demon - self-doubt
199 雷劫 雷劫 Thunder Tribulation event event tribulation tribulation Heavenly lightning Heavenly lightning
200 肉身 肉身 Body Tribulation event event tribulation tribulation Physical transformation Physical transformation
201 寻仇 尋仇 Vengeance Tribulation event event tribulation tribulation Past enemies return Past enemies return
202 情劫 情劫 Emotion Tribulation event event tribulation tribulation Love/attachment trial Love/attachment trial
203 阳罡 陽罡 Yang Force Tribulation event event tribulation tribulation Scorching yang energy Scorching yang energy
204 雷火 雷火 Thunder-Fire Tribulation event event tribulation tribulation Combined lightning and fire Combined lightning and fire
205 风灾 風災 Wind Disaster Tribulation event event tribulation tribulation Violent tempest Violent tempest
206 阴狱 陰獄 Yin Prison Tribulation event event tribulation tribulation Netherworld judgment Netherworld judgment
207 魔劫 魔劫 Demonic Tribulation event event tribulation tribulation Inner demons manifest Inner demons manifest
208 老死 老死 Died of Old Age event event death death Lifespan exhausted Lifespan exhausted
209 战死 戰死 Died in Battle event event death death
210 重伤不治 重傷不治 Died from Severe Injuries event event death death
211 平静 平靜 Calm emotion emotion
212 开心 開心 Happy emotion emotion
213 愤怒 憤怒 Angry emotion emotion
214 悲伤 悲傷 Sad emotion emotion
215 恐惧 恐懼 Fearful emotion emotion
216 惊讶 驚訝 Surprised emotion emotion
217 期待 期待 Expectant emotion emotion
218 厌恶 厭惡 Disgusted emotion emotion
219 疑惑 疑惑 Confused emotion emotion
220 疲惫 疲憊 Exhausted emotion emotion
221 系统菜单 系統選單 System Menu ui ui
222 开始游戏 開始遊戲 Start Game ui ui
223 加载游戏 載入遊戲 Load Game ui ui
224 保存游戏 儲存遊戲 Save Game ui ui
225 新建角色 新建角色 Create Character ui ui
226 删除角色 刪除角色 Delete Character ui ui
227 设置 設定 Settings ui ui
228 其他 其他 Other ui ui
229 境界 境界 Realm ui ui
230 年龄 年齡 Age ui ui
231 性别 性別 Gender ui ui
232 Male ui ui
233 Female ui ui
234 宗门 宗門 Sect ui ui
235 散修 散修 Rogue Cultivator ui ui Independent - no sect Independent - no sect
236 灵根 靈根 Spiritual Root ui ui
237 灵石 靈石 Spirit Stones ui ui
238 颜值 顏值 Appearance ui ui
239 基础战力 基礎戰力 Base Combat Power ui ui
240 情绪 情緒 Emotion ui ui
241 当前思考 當前思考 Current Thoughts ui ui
242 特质 特質 Traits ui ui Also: Persona Also: Persona
243 功法与装备 功法與裝備 Techniques & Equipment ui ui
244 长期目标 長期目標 Long-term Objective ui ui
245 短期目标 短期目標 Short-term Objective ui ui
246 设定目标 設定目標 Set Objective ui ui
247 清空目标 清空目標 Clear Objective ui ui
248 语言 語言 Language ui ui
249 中文 中文 Chinese ui ui
250 英文 英文 English ui ui

View File

@@ -2,6 +2,7 @@ from enum import Enum
class LanguageType(Enum): class LanguageType(Enum):
ZH_CN = "zh-CN" ZH_CN = "zh-CN"
ZH_TW = "zh-TW"
EN_US = "en-US" EN_US = "en-US"
class LanguageManager: class LanguageManager:

View File

@@ -35,6 +35,7 @@ def _lang_to_locale(lang_code: str) -> str:
""" """
locale_map = { locale_map = {
"zh-CN": "zh_CN", "zh-CN": "zh_CN",
"zh-TW": "zh_TW",
"en-US": "en_US", "en-US": "en_US",
} }
return locale_map.get(lang_code, "zh_CN") return locale_map.get(lang_code, "zh_CN")

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

186
tests/test_i18n_zh_tw.py Normal file
View File

@@ -0,0 +1,186 @@
import unittest
from unittest.mock import MagicMock, patch
import os
import sys
from pathlib import Path
# Ensure project root is in sys.path
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from src.classes.calendar import get_date_str
from src.classes.sect_region import SectRegion
from src.classes.world import World
from src.classes.language import language_manager, LanguageType
from src.classes.celestial_phenomenon import CelestialPhenomenon
from src.run.data_loader import reload_all_static_data
class TestI18nZhTW(unittest.TestCase):
"""測試繁體中文zh-TWi18n 功能"""
def setUp(self):
# 儲存當前語言
self.original_lang = str(language_manager)
def tearDown(self):
# 恢復語言
language_manager.set_language(self.original_lang)
def test_zh_tw_language_enum_exists(self):
"""驗證 ZH_TW 語言枚舉存在"""
self.assertTrue(hasattr(LanguageType, 'ZH_TW'))
self.assertEqual(LanguageType.ZH_TW.value, 'zh-TW')
def test_language_switch_to_zh_tw(self):
"""驗證可以切換到繁體中文"""
language_manager.set_language('zh-TW')
self.assertEqual(str(language_manager), 'zh-TW')
self.assertEqual(language_manager.current, LanguageType.ZH_TW)
def test_date_format_zh_tw(self):
"""驗證日期格式在繁體中文下正確顯示"""
language_manager.set_language('zh-TW')
# 13 = Year 1, Month 2 (formula: year*12 + month - 1 => 1*12 + 2 - 1 = 13)
date_str = get_date_str(13)
self.assertIn('', date_str)
self.assertIn('', date_str)
self.assertEqual(date_str, '1年2月')
def test_calendar_i18n_zh_tw(self):
"""驗證日期格式在繁體中文下正確顯示"""
language_manager.set_language('zh-TW')
# 測試日期格式
date_str = get_date_str(13)
self.assertIn('', date_str)
self.assertIn('', date_str)
def test_dynamic_translation_zh_tw(self):
"""驗證動態翻譯在繁體中文下正常工作"""
from src.i18n import t
language_manager.set_language('zh-TW')
# 測試基礎翻譯
text = t('male')
self.assertIn(text, ['', '男性']) # 接受可能的變體
# 測試帶參數翻譯
text = t('{winner} defeated {loser}', winner='張三', loser='李四')
self.assertIn('張三', text)
self.assertIn('李四', text)
self.assertIn('戰勝', text)
def test_realm_translation_zh_tw(self):
"""驗證境界翻譯在繁體中文下正確"""
# 使用已測試的日期格式功能來驗證翻譯機制
language_manager.set_language('zh-TW')
# 驗證基本翻譯機制正常工作
from src.i18n import t
result = t('qi_refinement')
self.assertIn(result, ['鍊氣', '煉氣', '練氣']) # 接受可能的變體(簡繁轉換差異)
def test_sect_region_desc_zh_tw(self):
"""驗證宗門駐地描述在繁體中文下正確"""
from src.i18n import t
language_manager.set_language('zh-TW')
# 測試宗門駐地翻譯
result = t('Sect Headquarters')
self.assertIn('宗門', result)
def test_language_fallback_zh_tw_to_zh_cn(self):
"""驗證繁體中文缺少翻譯時回退到簡體中文"""
from src.i18n import t
language_manager.set_language('zh-TW')
# 測試不存在的翻譯(應回退到簡體或原文)
text = t('non_existent_key_12345')
self.assertEqual(text, 'non_existent_key_12345')
def test_zh_tw_locale_files_exist(self):
"""驗證 zh-TW locale 檔案存在"""
from pathlib import Path
locale_dir = Path('src/i18n/locales/zh_TW/LC_MESSAGES')
# 檢查 .po 檔案
messages_po = locale_dir / 'messages.po'
self.assertTrue(messages_po.exists(), 'messages.po 應該存在')
game_configs_po = locale_dir / 'game_configs.po'
self.assertTrue(game_configs_po.exists(), 'game_configs.po 應該存在')
# 檢查 .mo 檔案
messages_mo = locale_dir / 'messages.mo'
self.assertTrue(messages_mo.exists(), 'messages.mo 應該存在')
game_configs_mo = locale_dir / 'game_configs.mo'
self.assertTrue(game_configs_mo.exists(), 'game_configs.mo 應該存在')
def test_zh_tw_po_file_integrity(self):
"""驗證 zh-TW .po 檔案完整性"""
try:
import polib
except ImportError:
self.skipTest('polib 未安裝')
locale_dir = Path('src/i18n/locales/zh_TW/LC_MESSAGES')
# 檢查 messages.po
messages_po = polib.pofile(str(locale_dir / 'messages.po'))
self.assertGreater(len(messages_po), 0, 'messages.po 應包含翻譯條目')
# 檢查 metadata
metadata = messages_po.metadata
self.assertIn('Language', metadata)
self.assertEqual(metadata.get('Language'), 'zh_TW')
def test_translation_coverage_zh_tw(self):
"""驗證 zh-TW 翻譯覆蓋率"""
try:
import polib
except ImportError:
self.skipTest('polib 未安裝')
locale_dir = Path('src/i18n/locales/zh_TW/LC_MESSAGES')
# 檢查 messages.po
messages_po = polib.pofile(str(locale_dir / 'messages.po'))
translated_count = sum(1 for entry in messages_po if entry.msgstr)
total_count = len(messages_po)
coverage = translated_count / total_count if total_count > 0 else 0
# 翻譯覆蓋率應該 > 95%
self.assertGreater(coverage, 0.95, f'翻譯覆蓋率應 > 95%,實際: {coverage:.1%}')
def test_action_translation_zh_tw(self):
"""驗證動作名稱在繁體中文下正確"""
from src.i18n import t
language_manager.set_language('zh-TW')
# 測試動作名稱翻譯
self.assertEqual(t('cultivate_action_name'), '修煉')
self.assertEqual(t('breakthrough_action_name'), '突破')
self.assertEqual(t('escape_action_name'), '逃離')
self.assertEqual(t('self_heal_action_name'), '療傷')
def test_emotion_translation_zh_tw(self):
"""驗證情緒在繁體中文下正確"""
from src.i18n import t
language_manager.set_language('zh-TW')
# 測試情緒名稱翻譯
self.assertEqual(t('emotion_calm'), '平靜')
self.assertEqual(t('emotion_happy'), '開心')
self.assertEqual(t('emotion_angry'), '憤怒')
self.assertEqual(t('emotion_sad'), '悲傷')
if __name__ == '__main__':
unittest.main()

View File

@@ -1,16 +1,18 @@
import { createI18n } from 'vue-i18n'; import { createI18n } from 'vue-i18n';
import zhCN from './zh-CN.json'; import zhCN from './zh-CN.json';
import zhTW from './zh-TW.json';
import enUS from './en-US.json'; import enUS from './en-US.json';
// Type-define 'en-US' as the master schema for the resource // Type-define 'en-US' as the master schema for the resource
type MessageSchema = typeof enUS; type MessageSchema = typeof enUS;
const i18n = createI18n<[MessageSchema], 'en-US' | 'zh-CN'>({ const i18n = createI18n<[MessageSchema], 'en-US' | 'zh-CN' | 'zh-TW'>({
legacy: false, // Use Composition API mode legacy: false, // Use Composition API mode
locale: localStorage.getItem('app_locale') || 'zh-CN', // Default locale locale: localStorage.getItem('app_locale') || 'zh-CN', // Default locale
fallbackLocale: 'en-US', // Fallback locale fallbackLocale: 'en-US', // Fallback locale
messages: { messages: {
'zh-CN': zhCN, 'zh-CN': zhCN,
'zh-TW': zhTW,
'en-US': enUS 'en-US': enUS
} }
}); });

348
web/src/locales/zh-TW.json Normal file
View File

@@ -0,0 +1,348 @@
{
"ui": {
"system_menu": "系統選單",
"system_menu_title": "系統選單",
"start_game": "開始遊戲",
"load_game": "載入遊戲",
"save_game": "儲存遊戲",
"create_character": "新增角色",
"delete_character": "刪除角色",
"settings": "設定",
"achievements": "成就",
"exit": "離開",
"other": "其他",
"language": "語言",
"chinese": "繁體中文",
"english": "English",
"back": "返回",
"confirm": "確定",
"cancel": "取消",
"llm_settings": "LLM設定",
"other_options": "其他選項",
"other_options_desc": "管理遊戲進程和結束。",
"return_to_main": "回到主選單",
"return_to_main_desc": "返回標題畫面(未儲存的進度將丟失)",
"quit_game": "結束遊戲",
"quit_game_desc": "關閉程式並結束到桌面"
},
"save_load": {
"loading": "載入中...",
"new_save": "新增存檔",
"new_save_desc": "點擊創建一個新的存檔檔案",
"empty": "暫無存檔",
"game_time": "遊戲時間: {time}",
"load": "載入",
"save_success": "存檔成功: {filename}",
"save_failed": "存檔失敗",
"load_confirm": "確定要載入存檔 {filename} 嗎?當前未儲存的進度將丟失。",
"load_success": "讀檔成功",
"load_failed": "讀檔失敗",
"fetch_failed": "獲取存檔列表失敗"
},
"llm": {
"loading": "載入中...",
"fetch_failed": "獲取配置失敗",
"test_success": "連接測試成功",
"save_success": "配置已儲存",
"test_save_failed": "測試或儲存失敗: {error}",
"api_key_required": "請填寫 API Key",
"base_url_required": "請填寫 Base URL",
"preset_applied": "已應用 {name} 預設 ({extra})",
"preset_extra_key": "請填寫 API Key",
"preset_extra_local": "請確保 Ollama 已啓動",
"sections": {
"quick_fill": "快速填充",
"api_config": "API 配置",
"model_selection": "模型選擇",
"run_mode": "運行模式"
},
"labels": {
"api_key": "API Key",
"base_url": "Base URL",
"normal_model": "智能模型 (Normal)",
"fast_model": "快速模型 (Fast)",
"what_is_api": "什麼是 API / 如何獲取?"
},
"descs": {
"normal_model": "用於處理複雜邏輯、劇情生成等任務",
"fast_model": "用於簡單判定、頻繁交互等任務"
},
"placeholders": {
"api_key": "在此填入你自己的 API Key (通常以 sk- 開頭)",
"base_url": "https://api.example.com/v1",
"normal_model": "例如: gpt-4, claude-3-opus, qwen-plus",
"fast_model": "例如: gpt-3.5-turbo, qwen-flash"
},
"modes": {
"default": "均衡 (Default)",
"default_desc": "自動選擇模型(推薦)",
"normal": "智能 (Normal)",
"normal_desc": "全用智能模型",
"fast": "快速 (Fast)",
"fast_desc": "全用快速模型"
},
"actions": {
"testing": "測試連接中...",
"test_and_save": "測試連通性並儲存"
},
"help": {
"title": "什麼是 API? 新手配置指南",
"q1_title": "🌐 1. 什麼是 API?",
"q1_content": "API (應用程式接口) 就像是一條“電話線”。本遊戲本身不具備思考能力,它通過這條線連接到遠端的 AI 大腦 (如 Qwen 或 DeepSeek 的服務器)。當遊戲進行每月結算並決定 NPC 動作時,會將相關信息通過 API 發給 AIAI 思考後再把結果傳回來。",
"q2_title": "⚡ 2. 推薦的模型 (2025版)",
"q2_qwen": "國內大廠 (阿里),穩定且免費額度大,適合入門。",
"q2_deepseek": "性價比極高,中文敘事邏輯更符合國人習慣。",
"q2_gemini": "Google 出品,綜合性能頂尖。",
"q3_title": "📝 3. 如何填入配置?",
"q3_content": "獲得 API 後你需要填入以下三大核心參數才能使用通常你可以在api提供方的文檔中找到 these 參數怎麼填:",
"q3_format_note": "⚠️ 重要提示:本遊戲僅支持 OpenAI 兼容格式的 API。如果某個服務不支持 OpenAI 兼容格式,將無法使用。推薦使用預設中的服務(它們都已確認兼容)。如需使用其他服務,請確認其提供 OpenAI 兼容接口。",
"q3_base_url": "API Base URL (接口地址): AI 的訪問大門,通常由廠商提供 (如 https://api.deepseek.com)。",
"q3_api_key": "API Key (密鑰): 你的身份憑證,就像賬號密碼。",
"q3_model_name": "Model Name (模型名稱): 告訴服務器你想用哪顆大腦,如 deepseek-chat 或 gemini-3-flash-preview。",
"q4_title": "🔗 4. 從哪裏獲取 Key?",
"q5_title": "🛡️ 5. 安全說明",
"q5_p1": "您的 API Key 僅儲存在您的本地電腦配置檔案中 (`static/local_config.yml`),由本地運行的遊戲後端直接與模型廠商通信。本遊戲 (Cultivation World Simulator) 是完全開源的程式,絕不會將您的 Key 上傳至任何第三方服務器。也請注意不要把local_config.yml檔案分享給任何人。",
"q5_p2": "使用token會產生費用請自行評估使用成本。",
"confirm": "我明白了"
},
"presets": {
"openai": "OpenAI",
"qwen": "通義千問",
"deepseek": "DeepSeek",
"siliconflow": "硅基流動",
"openrouter": "OpenRouter",
"gemini": "Gemini",
"ollama": "Ollama (本地)"
},
"help_links": {
"openai": "OpenAI Platform",
"qwen": "阿里雲百鍊 (Qwen / 最推薦)",
"deepseek": "DeepSeek 開放平臺 (國內推薦,便宜)",
"openrouter": "OpenRouter (全機型聚合,推薦)",
"siliconflow": "硅基流動 (國內聚合)",
"gemini": "Google AI Studio (Gemini)"
}
},
"game_start": {
"title": "開始遊戲",
"description": "設定世界的初始狀態。注意:遊戲開始後,這些設定將無法更改。",
"labels": {
"init_npc_num": "初始修士數量",
"sect_num": "活躍宗門數量",
"protagonist_mode": "主角引入模式",
"new_npc_rate": "每月新生修士概率",
"world_history": "世界歷史背景"
},
"tips": {
"sect_num": "宗門數量建議少於角色數量的一半",
"protagonist_random": "隨機引入:每次生成角色時,有 5% 的概率使用預設的“小說主角”模板。",
"protagonist_all": "全部引入:開局時強制生成所有預設的“小說主角”。",
"world_history": "可以包括上古、中古、近古。注意啓用此功能會調用LLM初始化時間會顯著增加。"
},
"placeholders": {
"world_history": "請輸入修仙界歷史背景(可選)。"
},
"options": {
"protagonist_none": "不引入主角",
"protagonist_random": "隨機引入主角",
"protagonist_all": "全部引入主角"
},
"actions": {
"start": "開始"
},
"messages": {
"load_failed": "載入配置失敗",
"start_success": "配置已儲存,正在初始化世界...",
"start_failed": "開始遊戲失敗"
}
},
"splash": {
"title": "AI修仙世界模擬器",
"start": "開始修仙",
"continue": "繼續道途",
"settings": "系統設定"
},
"loading": {
"title": "AI修仙世界模擬器",
"subtitle": "AI Cultivation World Simulator",
"phase": {
"scanning_assets": "掃描天地資源",
"loading_map": "構建洪荒山川",
"processing_history": "推演天道歷史",
"initializing_sects": "宗門入世",
"generating_avatars": "衆修士降臨",
"checking_llm": "連通天道意志",
"loading_save": "讀取前世因果",
"parsing_data": "解析天地法則",
"restoring_state": "恢復時空位面",
"finalizing": "萬象歸位",
"complete": "天地初開",
"chaos": "混沌初始",
"generating_initial_events": "推演初始因果"
},
"error": "初始化失敗",
"unknown_error": "未知錯誤",
"retry": "重新初始化",
"tips_label": "修行小貼士",
"elapsed": "已等待 {seconds} 秒",
"tips": [
"修改角色目標,可以改變該角色的行事風格",
"角色的性格特質,會極大影響角色的行事風格",
"在符合角色靈根的洞府修行,事半功倍",
"天靈根角色在任何洞府修行,都事半功倍",
"改變天地靈機,不僅會影響加成,還會微妙調整角色行事風格",
"偶爾會有修仙小說中的主角穿越進此方世界",
"每個角色都有自己的真實思考和情緒",
"除了修煉,煉丹和練氣也很重要",
"參加拍賣會可能撿漏,但要小心惡人的銜尾追殺",
"江湖同道會根據你的行爲取一個綽號",
"雙修雖好,還請剋制",
"在宗門駐地回血可以回滿HP",
"不同境界之間,戰力差距極大,越階挑戰難於登天",
"天命之子特質的角色,好運連連,奇遇不斷",
"現代世界的穿越者,只想回到現實世界,但這是不可能的",
"丹藥有生效的時間限制",
"由於大模型需要思考,遊戲啓動可能耗時較久",
"模擬世界對大模型token消耗較大請注意",
"開局時設定歷史,整個修仙世界也會隨之而改變",
"拍賣會中拍到的珍寶可能大大提升你的實力,但是要留好靈石"
]
},
"common": {
"year": "年",
"month": "月",
"none": "無",
"loading": "載入中...",
"version": "版本",
"confirm": "確認",
"cancel": "取消",
"error": "錯誤",
"success": "成功"
},
"game": {
"status_bar": {
"phenomenon": "天地靈機",
"effect": "效果:",
"duration": "持續 {years} 年",
"selector_title": "天道干涉:更易天象",
"empty_data": "暫無天象數據",
"cultivators": "修士: {count}",
"change_success": "天象已更易爲:{name}",
"click_to_change": "(點擊可更易天象)",
"author_bilibili": "B站空間",
"author_github": "Github倉庫"
},
"controls": {
"resume": "繼續遊戲",
"pause": "暫停遊戲",
"paused": "已暫停",
"closed_msg": "遊戲已關閉,您可以安全關閉此標籤頁。"
},
"event_panel": {
"title": "事件記錄",
"filter_all": "所有人",
"deceased": "(已故)",
"add_second": "+ 添加第二人",
"load_more": "向上滾動載入更多",
"empty_dual": "這兩人之間暫無事件",
"empty_single": "該修士暫無事件",
"empty_none": "暫無事件"
},
"info_panel": {
"popup": {
"effect": "效果:",
"drops": "掉落/產出:",
"hq": "駐地:",
"types": {
"elixir": "丹藥",
"plant": "植物",
"lode": "礦脈",
"item": "物品",
"weapon": "兵器",
"auxiliary": "輔助裝備",
"technique": "功法",
"sect": "宗門",
"persona": "特質",
"SWORD": "劍",
"SABER": "刀",
"SPEAR": "槍",
"STAFF": "棍",
"FAN": "扇",
"WHIP": "鞭",
"ZITHER": "琴",
"FLUTE": "笛",
"HIDDEN_WEAPON": "暗器"
}
},
"avatar": {
"set_objective": "設定目標",
"clear_objective": "清空目標",
"dead_with_reason": "已故 ({reason})",
"unknown_reason": "未知原因",
"long_term_objective": "長期目標",
"short_term_objective": "短期目標",
"stats": {
"realm": "境界",
"age": "年齡",
"hp": "HP",
"gender": "性別",
"alignment": "陣營",
"sect": "宗門",
"rogue": "散修",
"root": "靈根",
"magic_stone": "靈石",
"appearance": "顏值",
"battle_strength": "基礎戰力",
"emotion": "情緒"
},
"sections": {
"thinking": "當前思考",
"traits": "特質",
"techniques_equipment": "功法與裝備",
"materials": "材料",
"relations": "關係",
"current_effects": "當前效果"
},
"weapon_meta": "熟練度 {value}",
"relation_meta": "{owner}的{relation}",
"modals": {
"set_long_term": "設定長期目標",
"placeholder": "請輸入目標...",
"set_failed": "設定失敗",
"clear_confirm": "確定要清空該角色的長期目標嗎?"
}
},
"region": {
"view_sect": "查看宗門詳情",
"essence_title": "靈氣環境",
"essence_info": "{type}行靈氣 · 濃度 {density}",
"sections": {
"host": "洞府主人",
"animals": "動物分佈",
"plants": "植物分佈",
"lodes": "礦脈分佈",
"market": "坊市交易"
},
"host_meta": "主人",
"no_host": "無主(可佔據)",
"price_meta": "{price}靈石"
},
"sect": {
"stats": {
"alignment": "陣營",
"style": "風格",
"preferred": "擅長",
"members": "成員"
},
"sections": {
"intro": "宗門簡介",
"hq": "駐地:{name}",
"bonus": "宗門加成",
"techniques": "獨門絕學",
"members": "門下弟子"
},
"no_bonus": "無特殊加成"
}
}
}
}