TH1/Tools/translate_multilingual_2026_05_15.py
2026-05-16 00:34:14 +08:00

119 lines
5.3 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.

"""
翻译 Multilingual.xlsx 中 ID 19877, 19878 两条新增条目
- 19877: "AI接管" (UI按钮)
- 19878: V0.7.1j 版本更新日志
专有名词对齐主表 Multilingual.bak.xlsx:
- 十六夜咲夜 → TW:十六夜咲夜 / EN:Sakuya Izayoi / JP:十六夜咲夜 / KR:이자요이 사쿠야
- 射命丸文 → TW:射命丸文 / EN:Aya Shameimaru / JP:射命丸文 / KR:샤메이마루 아야
- 天狗的立风露 → TW:天狗的立風露 / EN:Tengu's Standing Windblast / JP:天狗の立風露 / KR:텐구의 입풍로
(注:原文写"天狗立风露",对齐游戏内官方名"天狗的立风露")
"""
import openpyxl, sys, io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
PATH = r'C:\TH1\TH1\Tools\Multilingual.xlsx'
# ============ ID 19877: "AI接管" ============
TW_19877 = 'AI接管'
EN_19877 = 'AI Takeover'
JP_19877 = 'AI操作'
KR_19877 = 'AI 위임'
# ============ ID 19878: V0.7.1j 版本日志 ============
TW_19878 = '''[版本V0.7.1j]
發佈日期 26.5.15
------- [bug修復] -------
1.修復了導致連線卡檔並無法繼續遊戲的bug
2.修復了在視野外被我方擊殺的單位可能錯誤殘留圖像的bug
3.修復了十六夜咲夜傳送至視野外時錯誤顯示其位置的bug
4.修復了存檔損壞可能導致遊戲無法正常開啟的bug
5.修復了射命丸文特色行動「天狗的立風露」圖示錯誤的bug
------- [其他優化] -------
1.修復了英語、日語、漢語、繁中若干翻譯問題'''
EN_19878 = '''[Version V0.7.1j]
Release Date: 2026.5.15
------- [Bug Fixes] -------
1. Fixed a bug that caused multiplayer sessions to stall, preventing the game from continuing.
2. Fixed a bug where units killed by our side outside the field of view could incorrectly leave residual images.
3. Fixed a bug where Sakuya Izayoi's position was incorrectly displayed when she teleported outside the field of view.
4. Fixed a bug where save corruption could prevent the game from opening properly.
5. Fixed a bug with the incorrect icon for Aya Shameimaru's unique action "Tengu's Standing Windblast".
------- [Other Improvements] -------
1. Fixed various translation issues in English, Japanese, Simplified Chinese, and Traditional Chinese.'''
JP_19878 = '''[バージョン V0.7.1j]
リリース日 2026.5.15
------- [バグ修正] -------
1.マルチプレイで進行が止まり、ゲームを続行できなくなる不具合を修正。
2.視界外で味方に倒されたユニットの画像が誤って残ることがある不具合を修正。
3.十六夜咲夜が視界外へテレポートした際、位置が誤って表示される不具合を修正。
4.セーブデータの破損によりゲームが正常に開けなくなる可能性のある不具合を修正。
5.射命丸文の固有行動「天狗の立風露」のアイコンが誤っていた不具合を修正。
------- [その他の最適化] -------
1.英語・日本語・中国語簡体字・繁体字の翻訳の問題をいくつか修正。'''
KR_19878 = '''[버전 V0.7.1j]
출시일 2026.5.15
------- [버그 수정] -------
1. 멀티플레이에서 진행이 멈춰 게임을 계속할 수 없게 되는 버그 수정.
2. 시야 밖에서 아군에게 처치된 유닛의 이미지가 잘못 남아있을 수 있는 버그 수정.
3. 이자요이 사쿠야가 시야 밖으로 순간이동 시 위치가 잘못 표시되는 버그 수정.
4. 세이브 파일 손상으로 게임이 정상적으로 열리지 않을 수 있는 버그 수정.
5. 샤메이마루 아야의 고유 행동 「텐구의 입풍로」 아이콘이 잘못 표시되던 버그 수정.
------- [기타 개선] -------
1. 영어, 일본어, 중국어 간체, 번체의 일부 번역 문제 수정.'''
# ============ 写入 ============
wb = openpyxl.load_workbook(PATH)
ws = wb.active
# 表头A:ID B:活跃 C:中文 D:繁中 E:英文 F:日文 G:韩文
# openpyxl 用 1-based 索引D=4, E=5, F=6, G=7
TRANSLATIONS = {
'19877': (TW_19877, EN_19877, JP_19877, KR_19877),
'19878': (TW_19878, EN_19878, JP_19878, KR_19878),
}
updated = 0
for row_idx in range(2, ws.max_row + 1):
id_cell = ws.cell(row=row_idx, column=1).value
if id_cell is None:
continue
# 去掉 BOM
key = str(id_cell).lstrip('').strip()
if key in TRANSLATIONS:
tw, en, jp, kr = TRANSLATIONS[key]
ws.cell(row=row_idx, column=4, value=tw) # D 繁中
ws.cell(row=row_idx, column=5, value=en) # E 英文
ws.cell(row=row_idx, column=6, value=jp) # F 日文
ws.cell(row=row_idx, column=7, value=kr) # G 韩文
updated += 1
print(f'已写入 ID {key}')
wb.save(PATH)
print(f'\n完成,共更新 {updated}')
# 校验
print('\n=== 校验 ===')
wb2 = openpyxl.load_workbook(PATH, data_only=True)
ws2 = wb2.active
for row in ws2.iter_rows(min_row=2, values_only=True):
if row[0] is None: continue
id_ = str(row[0]).lstrip('').strip()
print(f'ID {id_}:')
print(f' 繁中: {(row[3] or "")[:60]}...' if row[3] and len(row[3]) > 60 else f' 繁中: {row[3]}')
print(f' 英文: {(row[4] or "")[:60]}...' if row[4] and len(row[4]) > 60 else f' 英文: {row[4]}')
print(f' 日文: {(row[5] or "")[:60]}...' if row[5] and len(row[5]) > 60 else f' 日文: {row[5]}')
print(f' 韩文: {(row[6] or "")[:60]}...' if row[6] and len(row[6]) > 60 else f' 韩文: {row[6]}')
print()