/translation-generator

Tool generating a translations JSON file

Primary LanguageJavaScriptBSD 3-Clause Clear LicenseBSD-3-Clause-Clear

Monk banner

author: monkvision
name: monk-translation-generator
description: Tool generating a translations JSON file
version: 1.0.2

Usage

git clone https://github.com/monkvision/translation-generator.git
cp .env .env.local
yarn install
yarn start

Examples

Env .env.local

# .env.local
RUN=true

TRANSLATE_API_BASE_URL=https://libretranslate.de
FILE_PREVSTATE=files/prevState.json
FILE_ADDKEYS=files/addKeys.json
FILE_NEXTSTATE=files/nextState.json

SOURCE_LNG=en
TARGET_LNG=fr

DEBUG=true
AUTOTRANSLATE=true
NESTED_JSON=

Inputs files/prevState.json

{
  "zero": "zero",
  "one": "one",
  "two": "two",
  "three": "three",
  "four": "four",
  "five": "five"
}

files/addKeys.json

[
  "six",
  "seven",
  "eight",
  "nine"
]

Output files/nexState.json

{
  "zero": "zéro",
  "one": "un",
  "two": "deux",
  "three": "trois",
  "four": "quatre",
  "five": "cinq",
  "six": "six",
  "seven": "sept",
  "eight": "huit",
  "nine": "neuf"
}

License

This project is licensed under the Clear BSD license. See the LICENSE file for more info.