Skip to content

elgatosf/translate

Repository files navigation

@elgato/translate

Command-line tool for translating resource files with DeepL

@elgato/translate npm package Elgato homepage

Pre-requisites

  • DeepL auth key
  • English text in JSON or RESW format

Usage

  1. Install @elgato/translate
npm install @elgato/translate -g
  1. Create a translations.config.json file (learn more)
{
    "source": "locales/en.json",
    "targets": [
        {
            "code": "de"
        },
        {
            "code": "fr"
        }
    ]
}
  1. Translate your English text.
translate -k <DEEPL_AUTH_KEY>

Configuration

Main configuration that defines the source texts, and target languages.

Name Type Description Required
source string Path to the English text.
targets TargetLanguage[] Languages to translate to.
formality "less", "prefer_less", "default", "prefer_more", "more" Formality of the translations.

TargetLanguage

Target languages the source texts will be translated to.

Name Type Description Required
code string Language code, learn more.
formality "less", "prefer_less", "default", "prefer_more", "more" Formality of the translations.
file string Output file.
glossary string DeepL glossary identifier.
overrides Override[] Manual overrides.

Override

Allows for manual translations.

Name Type Description Required
text string Text that should not be translated with the remote service.
out string Output text; when unspecified, the original text is output.

CLI Options

-k, --auth-key <auth_key>

  • Default: undefined (required)
  • Type: String

The DeepL authentication key used to translate text with DeepL

-c, --config <path>

  • Default: translations.config.json
  • Type: String

Path to the configuration file.

About

Easily translate resources using DeepL.

Resources

License

Stars

Watchers

Forks

Packages

No packages published