Some python3 scripts for Foundry VTT developers to easily translate their packages in all core foundry's core languages
- Clone the repository or download the zip
git clone https://github.com/elizeuangelo/foundry-vtt-machine-translation.git
cd foundry-vtt-machine-translation
- Create and activate an virtual environment (optional)
python -m venv .
<windows>
Scripts\activate.bat
<linux>
source Scripts/activate
- Install the requirements
pip install -r requirements.txt
The scripts are located inside the .\tools
folder, just go to their folders and execute the scripts from the command-line, as in python -a index.py
.
This script searches for all js/ts documents inside the .\input
folder and creates an empty json containing all references in .\output
.
-a or -A:
Sorts out the references alphabetically.
[output-file] = en
:
Specifies the output json generated, defaults as en
.
This script is used to generate all languages files existing in core Foundry based on a single file containing all the references: [from_language].json
.
It works like this, first it reads .\input
folder for the [from_language].json
file, wich will be the base for all translations. Every other [to_language].json
file inside that folder will be read as well to ignore already existing references, this way those references will not be replaced by machine translation.
As items are being translated, [to_language].json
files are generated inside the .\output
folder, as well as an info.json
file. This file contains an easy copy and paste "languages"
object to put inside a module's manifest.json
, containing all to_languages
used in the project.
[from_language] = en
:
The base language, needs an analogous [from_language].json
file inside the .\input
folder.
[to_languages] = cn,de,es,fr,it,ja,ko,pl,pt,ru,th
:
Specifies the output languages included in the module.
This module is made by elizeuangelo and it is licensed under a Mozilla Public License Version 2.0.