npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

extra-amazontranslate

v1.1.15

Published

Translate long text from one language to another, via Amazon Translate.

Downloads

56

Readme

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.