TH1/Tools/translate_19968_19972.py
2026-05-21 02:45:55 +08:00

190 lines
12 KiB
Python
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- coding: utf-8 -*-
"""把 19968-19972 五条新增条目的繁中/英文/日文/韩文写回 Multilingual.xlsx
- 不修改中文列(列3)和其他元数据列
- 只填繁中(列4)/英文(列5)/日文(列6)/韩文(列7)
"""
import openpyxl
TRANSLATIONS = {
19968: {
"tw": "是否確認進入下一回合?",
"en": "Confirm proceeding to the next turn?",
"jp": "次のターンに進みますか?",
"kr": "다음 턴으로 진행하시겠습니까?",
},
19969: {
"tw": "始終顯示所選地塊所屬城市的邊界",
"en": "Always show city border of selected tile",
"jp": "選択中のタイルが属する都市の境界を常に表示",
"kr": "선택한 타일이 속한 도시의 경계 항상 표시",
},
19970: {
"tw": "點擊下一回合按鈕時二次確認",
"en": "Confirm again when clicking the Next Turn button",
"jp": "「次のターン」ボタンを押す際に再確認",
"kr": "「다음 턴」 버튼 클릭 시 재확인",
},
19971: {
"tw": "當前回合無法移動,下一回合開始時將自動按照指令路徑移動,並攻擊路徑上第一個遇到的敵人。若路徑上第一個碰到的是己方單位,則會停止移動。",
"en": "Cannot move this turn. At the start of the next turn, the unit will automatically move along the designated path and attack the first enemy it encounters along the way. If the first unit encountered along the path is an ally, the unit will stop moving.",
"jp": "現在のターンでは移動できない。次のターン開始時、指定された経路に沿って自動的に移動し、経路上で最初に遭遇した敵を攻撃する。経路上で最初に遭遇するのが味方ユニットの場合、移動を停止する。",
"kr": "이번 턴에는 이동할 수 없다. 다음 턴 시작 시 지정된 경로를 따라 자동으로 이동하며, 경로상 처음 마주친 적을 공격한다. 경로상 처음 마주치는 것이 아군 유닛이라면 이동을 멈춘다.",
},
19972: {
"tw": (
"[版本 V0.7.1m]\n"
"本次補丁完成13項bug修復及優化有部分較難修復的bug我們仍在排查修復中。\n"
"\n"
"---------[bug修復]-------------\n"
"1.修復了本地存檔損壞導致的遊戲無法正常啟動的bug\n"
"2.修復了連線模式下挖掘遺跡可能導致主客機不同步的bug\n"
"3.修復了滿血但是處於恐懼或疲勞負面狀態下的單位無法執行「休息」行動的bug\n"
"4.修復了戰績介面會顯示教學關卡紀錄的bug但是已有的紀錄暫時尚未清除\n"
"5.修復了攻擊處於十六夜咲夜保護狀態下的單位時攻擊流程執行不完整的bug逃脫、早苗投擲御神籤等\n"
"6.修復了首都被敵方佔領時仍能獲得大使館外交收入的bug\n"
"\n"
"----------[優化]--------------\n"
"1.新增設定選項「始終顯示所選地塊所屬城市的邊界」\n"
"2.新增設定選項「點擊下一回合按鈕時二次確認」\n"
"3.回合開始時新增提示音效\n"
"4.當地塊被城市中心建築擋住時,城市中心會自動半透明顯示\n"
"5.當從單位切換到該單位所處的地塊時,其所屬城市中心會播放彈動提示\n"
"6.優化了BGM輪播時可能會硬切戛然而止的情況\n"
"7.調整了靈烏路空能力「核融合預熱」的技能描述,移動時若路徑上遇到第一個單位是己方單位則會停止移動。"
),
"en": (
"[Version V0.7.1m]\n"
"This patch delivers 13 bug fixes and improvements. We're still investigating several other harder-to-reproduce issues.\n"
"\n"
"---------[Bug Fixes]-------------\n"
"1. Fixed a bug where corrupted local save data prevented the game from launching properly.\n"
"2. Fixed a bug in multiplayer where excavating Ruins could cause host/client desync.\n"
"3. Fixed a bug where units at full HP suffering from Fear or Fatigue could not perform the \"Rest\" action.\n"
"4. Fixed a bug where the Records screen displayed tutorial mission entries (existing entries are not cleared yet).\n"
"5. Fixed a bug where attacking a unit protected by Sakuya Izayoi caused the attack sequence to terminate incompletely (Escape, Sanae throwing Omikuji, etc.).\n"
"6. Fixed a bug where Embassy diplomatic income could still be collected after the capital was captured by an enemy.\n"
"\n"
"----------[Improvements]--------------\n"
"1. Added a settings option: \"Always show city border of selected tile\".\n"
"2. Added a settings option: \"Confirm again when clicking the Next Turn button\".\n"
"3. Added a notification sound at the start of each turn.\n"
"4. When a tile is blocked by the City Center building, the City Center now becomes semi-transparent automatically.\n"
"5. When switching from a unit to the tile it occupies, the owning City Center will play a bounce hint.\n"
"6. Improved BGM rotation to reduce abrupt cuts.\n"
"7. Adjusted Utsuho Reiuji's ability \"Nuclear Fusion Warm-up\" description: when moving, if the first unit encountered along the path is an ally, the unit will stop moving."
),
"jp": (
"[バージョン V0.7.1m]\n"
"本パッチでは13項目のバグ修正と最適化を実施しました。修正が困難な一部の不具合は引き続き調査中です。\n"
"\n"
"---------[バグ修正]-------------\n"
"1. ローカルセーブデータの破損によりゲームが正常に起動できなくなる不具合を修正\n"
"2. マルチプレイ時、遺跡発掘によりホスト・クライアント間で同期ずれが発生する不具合を修正\n"
"3. HP満タンかつ恐怖または疲労のデバフ状態にあるユニットが「休息」を実行できない不具合を修正\n"
"4. 戦績画面にチュートリアルのプレイ記録が表示される不具合を修正(既存の記録は現時点では消去されません)\n"
"5. 十六夜咲夜の保護状態下にあるユニットを攻撃した際、攻撃処理が不完全に終了する不具合を修正(逃走、早苗のおみくじ投擲など)\n"
"6. 首都が敵に占領された後も大使館の外交収入を獲得できてしまう不具合を修正\n"
"\n"
"----------[最適化]--------------\n"
"1. 設定項目「選択中のタイルが属する都市の境界を常に表示」を追加\n"
"2. 設定項目「『次のターン』ボタン押下時に再確認」を追加\n"
"3. ターン開始時に通知音を追加\n"
"4. 都市中心の建築物にタイルが隠れている場合、都市中心が自動的に半透明表示されるようにしました\n"
"5. ユニットからそのユニットのいるタイルへ切り替えた際、所属する都市中心がバウンスアニメーションでヒント表示されるようにしました\n"
"6. BGM切り替え時に音が途切れる、または唐突に止まる問題を改善\n"
"7. 霊烏路空の能力「核融合予熱」のスキル説明を調整:移動時、経路上で最初に遭遇するユニットが味方の場合、移動を停止します"
),
"kr": (
"[버전 V0.7.1m]\n"
"이번 패치에서는 13건의 버그 수정 및 최적화를 진행했습니다. 일부 수정이 어려운 버그는 계속 조사 중입니다.\n"
"\n"
"---------[버그 수정]-------------\n"
"1. 로컬 세이브 손상으로 인해 게임이 정상적으로 시작되지 않는 버그 수정\n"
"2. 멀티플레이 모드에서 유적을 발굴할 때 호스트와 클라이언트 간 동기화가 어긋나는 버그 수정\n"
"3. HP가 가득 찬 상태에서도 공포 또는 피로 디버프 상태인 유닛이 「휴식」 행동을 실행할 수 없는 버그 수정\n"
"4. 전적 화면에 튜토리얼 기록이 표시되는 버그 수정 (기존 기록은 현재로서는 삭제되지 않습니다)\n"
"5. 이자요이 사쿠야의 보호 상태에 있는 유닛을 공격할 때 공격 처리가 불완전하게 종료되는 버그 수정 (탈출, 사나에의 오미쿠지 투척 등)\n"
"6. 수도가 적에게 점령된 후에도 대사관 외교 수입을 획득할 수 있는 버그 수정\n"
"\n"
"----------[최적화]--------------\n"
"1. 설정 항목 「선택한 타일이 속한 도시의 경계 항상 표시」 추가\n"
"2. 설정 항목 「『다음 턴』 버튼 클릭 시 재확인」 추가\n"
"3. 턴 시작 시 알림 효과음 추가\n"
"4. 타일이 도시 중심 건축물에 가려질 때 도시 중심이 자동으로 반투명 표시되도록 변경\n"
"5. 유닛에서 해당 유닛이 위치한 타일로 전환할 때, 소속 도시 중심이 바운스 애니메이션으로 안내되도록 변경\n"
"6. BGM 전환 시 음이 끊기거나 갑자기 중단되는 문제 개선\n"
"7. 레이우지 우츠호의 능력 「핵융합 예열」 스킬 설명 조정: 이동 시 경로상 처음 마주치는 유닛이 아군이라면 이동을 멈춥니다"
),
},
}
def main():
src = "Multilingual.xlsx"
wb = openpyxl.load_workbook(src, data_only=False)
ws = wb.active
# 表头校验
headers = [ws.cell(1, c).value for c in range(1, ws.max_column + 1)]
expected = ["ID", "活跃文本", "中文", "繁中", "英文", "日文", "韩文"]
for i, name in enumerate(expected):
# 处理ID列可能含BOM
actual = str(headers[i] or "").lstrip("")
assert actual == name, f"{i+1}期望[{name}]实际[{actual}]"
print("表头校验通过")
id_col = 1
active_col = 2
zh_col = 3
tw_col = 4
en_col = 5
jp_col = 6
kr_col = 7
notrans_col = 12
updated = 0
for r in range(2, ws.max_row + 1):
raw_id = ws.cell(r, id_col).value
if raw_id is None:
continue
# 处理BOM
id_str = str(raw_id).lstrip("").strip()
try:
row_id = int(id_str)
except ValueError:
continue
if row_id not in TRANSLATIONS:
continue
# 严格校验只动 active=True 且 notrans!=True
active = str(ws.cell(r, active_col).value).lower()
notrans = str(ws.cell(r, notrans_col).value).lower()
if active != "true":
print(f"WARN: ID={row_id} active!=True, 跳过")
continue
if notrans == "true":
print(f"WARN: ID={row_id} 无需翻译=True, 跳过")
continue
zh_val = ws.cell(r, zh_col).value
if not zh_val:
print(f"WARN: ID={row_id} 中文为空, 跳过")
continue
t = TRANSLATIONS[row_id]
ws.cell(r, tw_col).value = t["tw"]
ws.cell(r, en_col).value = t["en"]
ws.cell(r, jp_col).value = t["jp"]
ws.cell(r, kr_col).value = t["kr"]
updated += 1
print(f" 写入 ID={row_id} (4 lang)")
print(f"共更新 {updated}")
if updated != len(TRANSLATIONS):
print(f"WARN: 期望{len(TRANSLATIONS)}行, 实际{updated}")
wb.save(src)
print(f"已保存到 {src}")
if __name__ == "__main__":
main()