Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Google Cloud Platform logo

Google Translate API Node.js Samples

With the Google Translate API, you can dynamically translate text between thousands of language pairs.

Table of Contents

Setup

  1. Read Prerequisites and How to run a sample first.

  2. Install dependencies:

     npm install
    

Samples

Translate

View the documentation or the source code.

Usage: node translate --help

Commands:
  detect <text>     Detect the language of the provided text
  list              List available translation languages.
  translate <text>  Translate the provided text to the target language.

Options:
  --apiKey, -k  Your Translate API key. Defaults to the value of the TRANSLATE_API_KEY environment
                variable.                                                                   [string]
  --help        Show help                                                                  [boolean]

Examples:
  node translate detect -k your-key "Hello world!"    Detect the language of "Hello world!".
  node translate list -k your-key                     List available translation languages.
  node translate translate -k your-key --to ru "Good  Translate "Good morning!" to Russian,
  morning!"                                           auto-detecting English.
  node translate translate -k your-key --to ru        Translate "Good morning!" to Russian from
  --from en "Good morning!"                           English.

For more information, see https://cloud.google.com/translate/docs