Aiden2014/DeadseatHan

A Chinese translation mod for the Deadseat

★ 3Forks 0PythonGitHub ↗Compare

README

TheDeadseat - Chinese Translation Mod

A comprehensive Chinese localization mod for TheDeadseat using the Godot Mod Loader system. This mod translates in-game text, UI elements, and video subtitles while preserving the original game's visual style with custom pixel fonts.

Translation Workflow

This mod addresses the challenge of translating hardcoded strings in the base game through an automated pipeline:

  1. Text Extraction - extract_text.py scans .tscn, .tres, and .gd files using regex patterns to extract translatable strings into template.csv
  2. Collaborative Translation - The template is uploaded to ParaTranz for community translation
  3. Format Processing - format_translation.py converts the translated CSV into Godot's translation format with proper line ending normalization
  4. Font Subsetting - extract_font_subset.py uses fontTools to generate minimal TTF files containing only the required glyphs, reducing file size

Localization Process

Step 1: Extract Text from Game Files

Navigate to the game's root directory and run the extraction script:

python mods-unpacked/Aiden-ChineseTranslation/.scripts/extract_text.py

This generates template.csv in .scripts/tmp/ containing all extractable strings from the base game.

Step 2: Prepare for Translation

Copy template.csv to translation_template.csv:

copy .scripts\tmp\template.csv .scripts\tmp\translation_template.csv

Upload translation_template.csv to ParaTranz project for collaborative translation.

Step 3: Import Translated Content

After translation is complete, download translation_template.csv from ParaTranz and place it in .scripts/tmp/. Then format the translation file:

python mods-unpacked/Aiden-ChineseTranslation/.scripts/format_translation.py

This outputs the formatted translations/translation.csv file used by Godot.

Step 4: Prepare Font Files

Download the Fusion Pixel Font Chinese variants:

  • fusion-pixel-8px-proportional-zh_hans.ttf
  • fusion-pixel-12px-proportional-zh_hans.ttf

Place both files in .scripts/tmp/fonts/.

Transform 12px Font (FontForge Required)

Open fusion-pixel-12px-proportional-zh_hans.ttf in FontForge:

  1. Select all glyphs → Element → Transformations → Transform
    • Set Origin to Glyph Origin
    • Scale X: 170%, Scale Y: 170%
  2. Center glyphs → Metrics → Center in Width
  3. Adjust metrics → Element → Font Info → OS/2 → Metrics
    • HHead Ascent: 1700
    • HHead Descent: -450
  4. Export as fusion-pixel-12px-proportional-zh_hans-subset-transform.ttf to fonts/ directory

Copy the 8px font directly to fonts/ as well.

Step 5: Generate Font Subsets

Run the subsetting script to create optimized font files containing only the characters used in translations:

python mods-unpacked/Aiden-ChineseTranslation/.scripts/extract_font_subset.py

This generates subset TTF files in .scripts/tmp/fonts/ that should be moved to the final fonts/ directory.

Technical Techniques

  • Dynamic Font Substitution - Uses FontVariation.take_over_path() to inject custom fonts without modifying game files
  • Script Extension Pattern - Extends base game classes via ModLoaderMod.install_script_extension() to intercept and translate text dynamically
  • Regex-based Parsing - Handles escaped strings and multi-line text with patterns like (?:[^"\\]|\\.)*
  • Python Type Hints - Full static typing with List[str], Set[str], and Path annotations for maintainable tooling scripts
  • Resource Takeover - Replaces image and video resources at runtime via take_over_path() for UI/cutscene translations

Technologies

  • Godot Mod Loader - Version 7.0.1 compatible modding framework
  • fontTools - Python library for TTF manipulation and subsetting
  • Fusion Pixel Font - Retro-styled Chinese pixel fonts (8px and 12px variants)
  • FontForge - Used for 12px font transformation (170% scaling, metrics adjustment)
  • ParaTranz - Crowdsourced translation platform with CC BY-NC 4.0 licensing
  • CSV Module - Python's built-in CSV handling for translation data

Project Structure

mods-unpacked/Aiden-ChineseTranslation/
├── .scripts/          # Python automation tools
├── extensions/        # GDScript extensions for runtime text injection
├── fonts/             # Custom pixel font TTF files
├── overwrites/        # Translated image and video assets
│   ├── art/          # UI textures and sprites
│   └── videos/       # Cutscene videos with Chinese subtitles
└── translations/      # CSV and compiled .translation files

Notable Directories:

  • .scripts/ - Contains the three-stage translation pipeline tools (extraction → formatting → font subsetting). The dot-prefix ensures these development scripts are excluded when exporting the mod, keeping the distributed package clean and minimal.
  • extensions/ - Monkey-patches game scripts to wrap strings with tr() for translation lookup
  • overwrites/ - Binary assets (PNG/OGV) with baked-in Chinese text, following original game copyright

Code Style

Following Godot best practices:

  • GDScript - CRLF line endings with tab indentation
  • Python - CRLF with 4-space indentation

Licenses

Resources

Contributors

Aiden2014

Issues