Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aws-translate-json

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-translate-json

Translate object values into other languages using the AWS translate API

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
52
decreased by-5.45%
Maintainers
1
Weekly downloads
 
Created
Source

AWS Translate JSON

Translate object values into other languages using the AWS translate API

Install as a npm package

  • npm install aws-translate-json

Usage

Create an AWS account (Skip this step if you already have one):

  • Create an account here.

There is a free tier to use the translation API that you can check here.

  • Login on AWS console and navigate to IAM panel
  • Click on Users tab
  • Click on Add User button
  • Follow the steps and add a User with access to the Translation API only
  • Store the access key and the secret in a secure place

Usage example:

const { AWSTranslateJSON } = require('aws-translate-json');

const awsConfig = {
    accessKeyId: process.env.AWS_TRANSLATE_ID,
    secretAccessKey: process.env.AWS_TRANSLATE_SECRET,
    region: process.env.AWS_TRANSLATE_REGION,
}

const source = "en";
const taget = ["pt", "it", "es"];

const { translateJSON } = new AWSTranslateJSON(awsConfig, source, taget);

translateJSON({
    key1: "my text here",
    key2: "other text",
    key3: {
        key4: "nested text"
    }
}).then(console.log);

/* OUTPUT:
    {
        pt: {
            key1: 'meu texto aqui',
            key2: 'outro texto',
            key3: {
                key4: 'texto aninhado'
            }
        },
        it: {
            key1: 'il mio testo qui',
            key2: 'altro testo',
            key3: {
                key4: 'testo nidificato'
            }
        },
        es: {
            key1: 'mi texto aquí',
            key2: 'otro texto',
            key3: {
                key4: 'texto anidado'
            }
        }
    }
*/

FAQs

Package last updated on 27 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc