With the Google Translate API, you can dynamically translate text between thousands of language pairs.
-
Read Prerequisites and How to run a sample first.
-
Install dependencies:
npm install
View the documentation or the source code.
Usage: node translate.js --help
Commands:
detect <input..> Detects the language of one or more strings.
list [target] Lists available translation languages. To return
language names in a language other thanEnglish,
specify a target language.
translate <toLang> <input..> Translates one or more strings into the target
language.
Options:
--help Show help [boolean]
Examples:
node translate.js detect "Hello world!" Detects the language of a string.
node translate.js detect "Hello world!" "Goodbye" Detects the languages of multiple strings.
node translate.js list Lists available translation languages with names in
English.
node translate.js list es Lists available translation languages with names in
Spanish.
node translate.js translate ru "Good morning!" Translates a string into Russian.
node translate.js translate ru "Good morning!" "Good night!" Translates multiple strings into Russian.
For more information, see https://cloud.google.com/translate/docs