How yourwaifu/deadlock-language-tool works
Project Type & Purpose
• This project is an automatic translation tool designed to convert game text from one language to another. It is not a full-scale translator but provides a “better than nothing” automated solution.
• The tool supports multiple languages (e.g., Shavian, Traditional Chinese, Japanese, Thai) and is intended to process game localization files, convert text (with variables, formatting, XML content, etc.), and prepare the resulting resources for integration into the game’s directory structure.
• The README explains a step-by-step pipeline—from resource copying to running language-specific scripts (like shavian.js)—and then relocating the output to game directories and updating configuration files (fonts.conf and boot.vcfg).
File Structure – Main Components
• Scripts and Core Modules:
– Files such as core.js, english.js, shavian.js, tchinese.js, google-test.js represent the translation engine. They probably encapsulate language-specific logic, conversion rules, and tests against external APIs (e.g., for Google Translate).
• Server Files:
– server.js likely provides a backend or a lightweight serving mechanism, which might be used for testing or previewing translations.
• Assets & Resources:
– The images folder, with various CSS diff files and VTex (likely proprietary asset formats), indicates that the project also involves managing assets related to HUDs and images.
– The presence of fonts.conf in the images folder suggests that font configuration is a part of making translations work properly, particularly for languages/scripts with unique font needs.
• Web Client:
– The contained web directory, especially web/client (with index.html) and web/js (with index.js), represents a frontend component. This could provide a user interface for previewing translations, testing output, or even configuring the tool.
• Miscellaneous:
– Files like sample-game-text.txt and sample-translator-input.html may be used to test or demonstrate how the translation process works.
– Configuration & Dependency Files: package.json and package-lock.json define dependencies and scripts needed to run the tool.
Key Architectural Components
a. Translation Engine:
– A central “Translation Engine” module comprising core.js and language-specific scripts (shavian.js, tchinese.js, english.js, etc.).
– Include an external API integration component if google-test.js is testing such functionality.
– Show processing stages: Reading raw game text, handling variables/formatting/XML, then outputting translated text.
b. Resource Pipeline / Integration:
– A “Resource Manager” component that deals with copying resources from the game’s localization directory to the project’s resources folder and vice versa.
– Indicate tools for packaging the output (zipping the translated resources) for publishing.
c. Server / Backend Service:
– Represent server.js as an optional backend or test service that might expose APIs or serve local previews.
d. Web Frontend Interface:
e. Assets & Configuration:
– Note the “Assets” (CSS, VTex files, images) and “Font Configuration” (fonts.conf) that work alongside the translation outputs.
– Highlight the configuration file (boot.vcfg) editing step mentioned in the README.
Relationships & Data Flow
• Flow: Translation Engine processes the text (using language-specific modules) and outputs translated files.
• From the Translation Engine, indicate integration with the Resource Manager, which then packages and places the translated output in the correct game directories.
• Optionally, illustrate external API calls (if applicable) from the Translation Engine to services (e.g., Google Translate).
Architectural Patterns & Design Principles
• The design follows a modular approach, with separation between core translation functionality, language-specific handling, resource management, and user interaction.
• Layering: Input → Processing (translation) → Output (resource packaging and integration).
• If applicable, show dependency inversion by indicating that each language script can plug into the core engine.
• “pipeline” structure present in the resource flow.