There are two ways to use the CLI to translate text with Amazon Translate. For short
text, you can
provide the text that you want to translate as a parameter of the
translate-text command. For longer text, you can provide the source
language, target language, and text in a JSON file.

To use Amazon Translate from the command line, you need to know the endpoint and region
for the
service. For a list of available endpoints and regions, see Guidelines and Limits.

Translate Text Using the Command Line

The following example shows how to use the translate-text operation from
the command line to translate text. The example is formatted for Unix, Linux, and
macOS.
For Windows, replace the backslash (\) Unix continuation character at the end of each
line with a caret (^). At the command line, type the following.

Translate Text Using a JSON File

This example shows how to use the translate-text operation to translate a
longer text block from a JSON file. You can specify the source and target language
on
the command line, but in this example, you specify them in the JSON file.

Note

The JSON file is formatted for readability. Reformat the "Text" field
to remove line breaks.

The example is formatted for Unix, Linux, and macOS. For Windows, replace the
backslash (\) Unix continuation character at the end of each line with a caret
(^).