Files
proxycast/scripts/extract_remaining_todos.py
T
budi 157db3fd78 fix: improve i18n translations and fix DOM replacement order
- Fixed 20 translation entries with concatenated words and incorrect formatting
- Fixed critical bug in DOM replacer that caused partial translations
- Sort translation patches by length (longest first) to prevent substring replacement issues
- Fixed TypeScript and ESLint errors
- Added comprehensive documentation of fixes
2026-01-08 04:32:05 +07:00

33 lines
1.0 KiB
Python

#!/usr/bin/env python3
"""Extract remaining TODO entries for manual translation"""
import json
from pathlib import Path
EN_FILE = Path(__file__).parent.parent / 'src' / 'i18n' / 'patches' / 'en.json'
OUTPUT_FILE = Path(__file__).parent.parent / 'translations-remaining.json'
print("Loading en.json...")
with open(EN_FILE, 'r', encoding='utf-8') as f:
data = json.load(f)
# Extract all TODO entries
todos = {}
for key, value in data.items():
if isinstance(value, str) and value.startswith('[TODO: Translate]'):
chinese = value.replace('[TODO: Translate] ', '')
todos[chinese] = "" # Empty string for translation
print(f"Found {len(todos)} entries to translate")
print(f"Saving to {OUTPUT_FILE}...")
# Save to file
with open(OUTPUT_FILE, 'w', encoding='utf-8') as f:
json.dump(todos, f, ensure_ascii=False, indent=2)
print("Done!")
print()
print("Next steps:")
print("1. Open translations-remaining.json")
print("2. Fill in English translations for each Chinese text")
print("3. Run import_translations.py to merge back")