extra-amazontranslate
Translate long text from one language to another (via "Amazon Translate").
Last updated a year ago by wolfram77 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install extra-amazontranslate -g
SYNC missed versions from official npm registry.

Translate long text from one language to another (via "Amazon Translate").

Do you want to:

Sample: "I want to order a stuffed crust pizza".

setup

install

  1. Run npm install -g extra-amazontranslate in console.
  2. To install this as a package use npm install extra-amazontranslate.

console

amazontranslate "I want to order a stuffed crust pizza" --target "spanish"
# get text in spanish

amazontranslate -t input.txt -o output.txt --target "japanese"
# output.txt created from japanese translation of input.txt

amazontranslate "Hello 911, my husband is in danger!" -ot "fr"
# get text in french

echo "Dead man walking." | amazontranslate --log -ot "pt"
# get text (from stdin) in portugese (log enabled)

Supported language pairs?

reference

amazontranslate [options] <text>
# text: input text

# Options:
# --help:        show this help
# -l, --log:     enable log
# -o, --output:  set output text file
# -t, --text:    set input text file
# -r, --retries: set translate retries (8)
# -os, --source: set source language (auto)
# -ot, --target: set target language (en)
# -bs, --block_separator: set translate block separator (.)
# -bl, --block_length:    set translate block length (2500)
# -c*, --config_*: set amazon config options (see Extra AWS Config options below)

# Environment variables:
$TRANSLATE_LOG     # enable log (0)
$TRANSLATE_OUTPUT  # set output text file
$TRANSLATE_TEXT    # set input text file
$TRANSLATE_RETRIES # set translate retries (8)
$TRANSLATE_SOURCE  # set source language (auto)
$TRANSLATE_TARGET  # set target language (en)
$TRANSLATE_BLOCK_SEPARATOR # set translate block separator (.)
$TRANSLATE_BLOCK_LENGTH    # set translate block length (2500)
... # see Extra AWS Config options below

See Extra AWS Config options.

package

const amazontranslate = require('extra-amazontranslate');

await amazontranslate('I want to order a stuffed crust pizza', {target: 'es'});
// get text in spanish

await amazontranslate('Dead man walking.', {log: true, target: 'pt'});
// get text in portugese (log enabled)

reference

const amazontranslate = require('extra-amazontranslate');

amazontranslate(text, options={})
// text:    input text to be translated
// options: translation and config options
// -> Promise <table of contents>

# -r, --retries: 
# -os, --source: 
# -ot, --target: set target language (en)
# -bs, --block_separator: set translate block separator (.)
# -bl, --block_length:    set translate block length (2500)
# -c*, --config_*: set amazon config options (see Extra AWS Config options below)

// Default options:
options = {
  stdio: [0, 1, 2], // set child process stdio
  log: false,       // enable log
  retries: 8,       // set translate retries
  source: 'auto',   // set source language
  target: 'en',     // set target language
  block: {
    separator: '.', // set translate block separator
    length: 2500    // set translate block length
  },
  config: null      // set amazon config options (see Extra AWS Config options below)
}

See Extra AWS Config options.

similar

Do you need anything similar?

  • extra-awsconfig can get AWS config from arguments and environment variables.
  • extra-amazontts can synthesize speech from text for multiple languages.

Suggestions are welcome. Please create an issue.

nodef

References: Extra AWS Config, AWS Translate API, language codes, language pairs.

Current Tags

  • 1.1.10                                ...           latest (a year ago)

34 Versions

  • 1.1.10                                ...           a year ago
  • 1.1.9                                ...           a year ago
  • 1.1.8                                ...           a year ago
  • 1.1.7                                ...           a year ago
  • 1.1.6                                ...           a year ago
  • 1.1.5                                ...           a year ago
  • 1.1.4                                ...           a year ago
  • 1.1.3                                ...           a year ago
  • 1.1.2                                ...           a year ago
  • 1.1.1                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.5                                ...           a year ago
  • 1.0.4                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
  • 0.1.8                                ...           a year ago
  • 0.1.7                                ...           a year ago
  • 0.1.6                                ...           a year ago
  • 0.1.5                                ...           a year ago
  • 0.1.4                                ...           a year ago
  • 0.1.3                                ...           a year ago
  • 0.1.2                                ...           a year ago
  • 0.1.1                                ...           a year ago
  • 0.1.0                                ...           a year ago
  • 0.0.8                                ...           a year ago
  • 0.0.7                                ...           a year ago
  • 0.0.6                                ...           a year ago
  • 0.0.5                                ...           a year ago
  • 0.0.4                                ...           a year ago
  • 0.0.3                                ...           a year ago
  • 0.0.2                                ...           a year ago
  • 0.0.1                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (7)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |