1.1.15 • Published 2 years ago

extra-amazontranslate v1.1.15

Weekly downloads
2
License
MIT
Repository
github
Last release
2 years ago

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

  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?

Suggestions are welcome. Please create an issue.

nodef

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

1.1.12

2 years ago

1.1.15

2 years ago

1.1.14

2 years ago

1.1.13

2 years ago

1.1.11

4 years ago

1.1.10

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago