Machine translation
Without the --provider option, the yfm translate command translates documentation via Yandex Translate. This is the fastest translation method: it suits draft versions and regular language synchronization, but the result usually needs proofreading. For higher quality, use AI translation or CAT tools.
Usage
-
Get an authorization token: an OAuth token, an IAM token, or a service account API key.
-
Find out the folder ID for which your account has the
ai.translate.userrole or higher. -
Estimate the translation volume without API requests:
yfm translate -i ./docs --source ru --target en --auth <token> --folder <folder-id> --dry-run -
Run the translation:
yfm translate -i ./docs --source ru --target en --auth <token> --folder <folder-id>
Translated files appear in the target language folder - docs/en in the example above.
Parameters
Common parameters (--source, --target, --files, --include, --exclude, --dry-run, and others) are described on the Localization page. Below are the yandex provider parameters.
|
Parameter |
Description |
|
|
Authorization token: a value or a path to a file with the token. The type is detected by prefix: |
|
|
Folder ID for which your account has the |
|
|
Path to a YAML file with a glossary - pairs of terms that must be translated in a fixed way |
Limits
Yandex Translate has limits on the amount of translated text. The CLI reduces the volume on its own: documents are split into segments, and repeated segments are translated once.
If a limit is still exceeded, the command fails with the TRANSLATE_LIMIT_EXCEED error. In that case, retry later or narrow the file set with filters - already translated files can be excluded.
The --dry-run option helps estimate the text volume before running.