Skip to content

An utility tool for developers to easily translate their packages in all core foundry's languages

License

Notifications You must be signed in to change notification settings

elizeuangelo/foundry-vtt-machine-translation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Foundry VTT - Machine Translation

GitHub release (latest SemVer) GitHub release (latest SemVer)

Donations

Crypto

BTC ADA ETH LTC DOGE

Others

ko-fi BuyCoffee

Some python3 scripts for Foundry VTT developers to easily translate their packages in all core foundry's core languages

Installation

  1. Clone the repository or download the zip
git clone https://github.com/elizeuangelo/foundry-vtt-machine-translation.git
cd foundry-vtt-machine-translation
  1. Create and activate an virtual environment (optional)
python -m venv .

<windows>
Scripts\activate.bat

<linux>
source Scripts/activate
  1. Install the requirements
pip install -r requirements.txt

How to Use

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.

index.py [-aA] [output-file]

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.

translator.py [from_language] [to_languages]

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.

License

This module is made by elizeuangelo and it is licensed under a Mozilla Public License Version 2.0.

About

An utility tool for developers to easily translate their packages in all core foundry's languages

Resources

License

Stars

Watchers

Forks

Packages

No packages published