Files
TwitchDropsMiner/add_language_names.py
Fengqing Liu 46291e83d8 Update CLAUDE.md with comprehensive translation system documentation
This commit documents the current state of the translation system architecture
and consolidates the recent i18n refactoring work.

Documentation updates:
- Add detailed Translation System section describing architecture
- Document all 19 supported languages with native names
- Include TypedDict schema structure and usage examples
- Update project structure to show lang/ directory
- Expand Key Files section with i18n/ package details
- Document language persistence and dynamic switching

Translation system changes:
- Migrate English translations from hardcoded to lang/English.json
- Add English.json as single source of truth for fallback translations
- Update all language files with comprehensive GUI translations
- Refactor translator.py to load English from JSON file
- Add language_name and english_name fields to all translations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 21:48:30 +11:00

34 lines
1.0 KiB
Python

#!/usr/bin/env python3
"""Add language_name field to all translation JSON files."""
import json
from pathlib import Path
LANG_PATH = Path(__file__).parent / "lang"
def add_language_names():
"""Add language_name field to each translation file based on filename."""
for filepath in LANG_PATH.glob("*.json"):
# Extract language name from filename (without .json extension)
language_name = filepath.stem
print(f"Processing {filepath.name}...")
# Read the JSON file
with open(filepath, 'r', encoding='utf-8') as f:
data = json.load(f)
# Add language_name at the beginning
updated_data = {"language_name": language_name}
updated_data.update(data)
# Write back to file with proper formatting
with open(filepath, 'w', encoding='utf-8') as f:
json.dump(updated_data, f, ensure_ascii=False, indent=4)
print(f" ✓ Added language_name: {language_name}")
if __name__ == "__main__":
add_language_names()
print("\n✓ All translation files updated!")