### Translate i18n JSON files using npx CLI Source: https://github.com/while1618/i18n-auto-translation/blob/main/README.md This command demonstrates how to use the `i18n-auto-translation` CLI tool via `npx`. It requires a subscription key (`-k`), the project directory containing i18n files (`-d`), and the desired target language for translation (`-t`). ```bash $ npx i18n-auto-translation -k SUBSCRIPTION_KEY -d PROJECT_DIR -t DESIRED_LANGUAGE ``` -------------------------------- ### i18n-auto-translation Command-Line Interface Options Source: https://github.com/while1618/i18n-auto-translation/blob/main/README.md Detailed reference for command-line arguments used to configure the i18n-auto-translation tool. This includes options for selecting API providers, specifying input/output file paths, defining source and target languages, and controlling translation behavior such as overriding existing translations, setting request delays, and managing output formatting. ```APIDOC Options: --help: Alias: / Description: All available options. Default: / --version: Alias: / Description: Current version. Default: / --apiProvider: Alias: -a Description: API Provider. Default: google-official --key [required]: Alias: -k Description: Subscription key for the API provider. Default: / --region: Alias: -r Description: Key region. Used only by the Official Azure API. Default: global --filePath [filePath or dirPath required]: Alias: -p Description: Path to a single JSON file. Default: / --dirPath [filePath or dirPath required]: Alias: -d Description: Path to a directory in which you will recursively find all JSON files named [from].json (e.g. en.json) Default: / --from: Alias: -f Description: From which language you want to translate. Default: en --to [required]: Alias: -t Description: To which language you want to translate. Default: / --override: Alias: -o Description: Override existing translation(s). Default: false --certificatePath: Alias: -c Description: Path to a custom certificate. Default: / --spaces: Alias: -s Description: Number of spaces to use when generating output JSON files. Default: 2 --maxLinesPerRequest: Alias: -l Description: Maximum number of lines per request. For every `x` number of lines, separated request is sent to the api. Default: 50 --context: Alias: -x Description: Context for the translation. Used only by the DeepL API. Default: / --formality: Alias: -m Description: Formality for the translation. Used only by the DeepL API. Default: default --trim: Alias: -i Description: Trim string after translation. Default: true --delay: Alias: -e Description: Delay between every request made to the translate api. Default: 250 --saveTo: Alias: -v Description: Override where translated file should be saved. (use only with `--filePath` option) Default: / --glossary: Alias: -g Description: Specify the glossary to use for the translation. Used only by the DeepL API. Default: / ``` -------------------------------- ### Supported Translation Providers and CLI Identifiers Source: https://github.com/while1618/i18n-auto-translation/blob/main/README.md A comprehensive list of officially supported translation service providers, detailing their full names and the corresponding identifiers used for command-line interface operations within the i18n-auto-translation project. ```APIDOC Provider List: - Google Translate Official (CLI: google-official) - Azure Translator Official (CLI: azure-official) - Azure Translator RapidAPI (CLI: azure-rapid) - Deep Translate RapidAPI (CLI: deep-rapid) - Lecto Translation RapidAPI (CLI: lecto-rapid) - Lingvanex Translate RapidAPI (CLI: lingvanex-rapid) - NLP Translation RapidAPI (CLI: nlp-rapid) - Deepl (CLI: deepl-pro / deepl-free) ``` -------------------------------- ### API for Custom Translation Provider Integration Source: https://github.com/while1618/i18n-auto-translation/blob/main/README.md Defines the interface and steps required to integrate a new custom translation provider. This involves extending the base 'Translate' class and implementing its core translation method, followed by registration within the system's configuration. ```APIDOC Interface for Custom Translation Providers: Base Class to Extend: Translate Location: src/translate/providers/ Required Method Implementation: callTranslateAPI(text: string, sourceLang: string, targetLang: string): Promise Purpose: Performs the actual translation using the custom provider's API. Parameters: text (string): The text to be translated. sourceLang (string): The source language of the text. targetLang (string): The target language for translation. Returns: Promise - A promise that resolves with the translated text. Registration Steps: 1. Register the new provider class in 'translate-supplier.ts'. 2. Add the new provider's CLI identifier to the choices in 'cli.ts'. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.