original concept by Poltergeist
Translation Data by SimKDT
- Run the
pzTranslate.exe(utilizes PyInstaller built PyQt GUI) - Select any directory to process.
- Any
Translatesubdirectories will be processed. - Note: Google Translator has a 200k character daily limit.
- Any
- Select which Languages you would like files to be generated for.
- Note: Selecting no languages will enable all languages.
- Optionally enable Overwrite to re-translate keys that already exist in target files.
- By default, existing translated keys are preserved and only missing ones are filled in.
The tool targets B42 Translate directories and always outputs .json files. Both .json and old-format .txt source files are supported as input.
| Source files | Output |
|---|---|
.json |
.json (UTF-8) |
.txt (pre-42.15 format) |
.json (UTF-8) — converted automatically |
Old pre-42.15 .txt translation files are parsed and written out as properly formatted B42.15 .json files as a natural part of the translation process.
Note: You can also download these programs if you wish to modify any stage of the translation process.
| Dependency | Purpose |
|---|---|
| Python 3.10+ | Runs the translation and GUI scripts. |
| deep_translator 1.11.4+ | Handles automated language translation via Google Translate. |
| PyQt5 5.15.11+ | Provides the graphical user interface (GUI). |
| PyInstaller 6.11.1+ | Packages the Python script into a standalone executable. |
In any CLI (cmd), run repository/pz-translator/translate.py with any relative path to any directory you want processed.
Parameters:
| Parameter | Description |
|---|---|
<directory> |
Root directory to process (required) |
-source <code> |
Source language code (default: EN) |
-languages <codes> |
Space-separated language codes to translate to (default: all) |
-overwrite |
Re-translate keys that already exist in target files |
Example Parameters:
For a singular sub-mod within a mods folder:
py translate.py "\Workshop\<your mod>\Contents\mods\<your mod>\"
For a mod along with any sub-mods:
py translate.py "\Workshop\<your mod>\"
For all mods, specific languages only:
py translate.py "\Workshop\" -languages DE FR RU
For all mods, overwriting all existing translations:
py translate.py "\Workshop\" -overwrite
- The script will parse through every subdirectory to find any
\Translatedirectories. - If you install PyQt5 you can also run
TranslateGUI.pydirectly.
Go to the translate.py file and select to edit configurations.
Once in the configurations menu, enter in a relative path you want processed as the parameter.
Example for Windows — you can also write this into a .cmd file for a shortcut.
py "repository/pz-translator/translate.py" "relative-path to translate"
You can add a task like this to run the script. This will target the workspaceFolder for translation.
{
"version": "2.0.0",
"tasks": [
{
"label": "Translate Project",
"type": "shell",
"command": "py",
"args": [ "repository/pz-translator/translate.py", "${workspaceFolder}" ],
"group": "none",
"presentation": {
"reveal": "always",
"panel": "new"
}
}
]
}See https://go.microsoft.com/fwlink/?LinkId=733558 for the documentation about the tasks.json format
Deep translator supports different translation backends. More information at: https://pypi.org/project/deep-translator/

