Skip to content

Files

Latest commit

18686f1 · Jun 1, 2024

History

History
88 lines (80 loc) · 2.74 KB

README.md

File metadata and controls

88 lines (80 loc) · 2.74 KB

Install

Download source code from github and go to project directory run this command:

npm install

Or install by npm directly:

npm install translate-rpgmaker-plugin --global

Or download single executable app from release page.

Config

Go to project directory, rename .env.example to .env and fill it on demand.

If using executable binary, put .env in the same directory.

DEEPL_KEY=
AZURE_KEY=
AZURE_REGION=

Get key from:

  1. DeepL
  2. Azure Text Translation
  3. Google Cloud Translation

Or just copy text to existing translator manually.

Usage

Use this command in project directory:

node ./translate.js [options] <plugin>

Or use use this command in anywhere(when installing globally):

translate-rpgmaker-plugin [options] <plugin>

Or use single executable app:

./translate-rm [options] <plugin> 
  • On Windows:
    .\translate-rm.exe [options] <plugin> 
    

Options

Arguments:
  plugin           plugin path

Options:
  --src <lang>     source language
  --target <lang>  target language
  --txt <path>     translated text file path to import (default: "")
  --output <dir>   output Directory (default: "./")
  --engine <type>  translate engine type (choices: "deepl", "azure", "google", "manual", default: "manual")
  --split-text     for translate large amounts of text, but be aware of API quotas (default: false)
  -h, --help       display help for command

Translate engine types:
  deepl
    needs DEEPL_KEY in env vars
  azure
    needs AZURE_KEY and AZURE_REGION in env vars
  google
    use $ gcloud auth application-default login
  manual
    will generate txt file for manual translation (ex. website version of google translate, microsoft word, etc..)

Available languages:

  1. DeepL
  2. Azure Text Translation
  3. Google Cloud Translation

Programming

import translatePlugin from "translate-rpgmaker-plugin";
const options = {
    pluginPath: "path/to/plugin/xxx.js",
    srcLang: "en",
    targetLang: "zh",
    outputDir: "path/to/output", // default: "./"
    engineType: "deepl", // default: "manual"
    txtPath: "path/to/import/xxx.txt", // default: ""
    splitText: false, // default: false
};
await translatePlugin(options);