Coder Social home page Coder Social logo

marcguillemdev / aws-json-translator-cli Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 5.92 MB

A command line tool to translate JSON files using AWS Translate.

License: MIT License

Java 100.00%
json translate json-translate aws amazon amazon-web-services aws-translate cli commandline-tool java

aws-json-translator-cli's Introduction

cli icon AWS JSON TRANSLATOR CLI

AWS JSON TRANSLATOR CLI is a command line application to translate JSON files using AWS Translate.

Table of contents

๐Ÿ”ง Features

  • ๐Ÿ“„ Deep and non-deep JSON Files (support for JSON Arrays too)
  • ๐Ÿ‘” Support for formality and profanity (to view supported languages see the links below)
  • ๐Ÿ”‘ Easy configuration of keys and region with a "set-configuration" command.
  • ๐Ÿ“ƒ Translate without altering the structure.

๐Ÿ’ป Usage

Create an IAM account with AWS Translation:

  • 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
  • Save the access key and the secret in a secure place

Available regions: AWS Regions documentation With both keys and region, we are ready to do the configuration.

Running configuration

  1. Configure Access Key, Secret Key and Region using "set-configuration" command specifying parameters.

    • --awsAccessKey. OPTIONAL. Your AWS Access Key from IAM User.
    • --awsSecretKey. OPTIONAL. Your AWS Secret Key from IAM User.
    • --awsRegion. OPTIONAL. Your AWS Region.

All parameters are optional, so you can set individually each property if you want.

Run .exe

.\aws-json-translator.exe set-configuration --awsAccessKey exampleAccessKey --awsSecretKey exampleSecretKey --awsRegion eu-west-3

Run .jar

java -jar aws-json-translator.jar set-configuration --awsAccessKey exampleAccessKey --awsSecretKey exampleSecretKey --awsRegion eu-west-3
  1. Translate JSON file using "translate-json" command specifying required parameters.

    • -sl or --sourceLanguage. REQUIRED. Source language of JSON in ISO 3166 alpha-2 code.
    • -tl or --targetLanguage. REQUIRED. Target language you want to translate to in ISO 3166 alpha-2 code.
    • -sf or --sourceFile. REQUIRED. Source file containing JSON to translate.
    • --enableProfanityFilter. OPTIONAL. Enable profanity filter. (Empty parameter)
    • --formality. OPTIONAL. Formality level. Possible values: formal, informal. Default: formal
    • --customTerminology. OPTIONAL. Custom terminology name list separated by comma.

To use custom terminology, you have to create a custom terminology in Amazon Translate and then put the name in --customTerminology parameter. For more information, see Amazon Translate Custom Terminology.

Basic usage of "translate-json"


Run .exe

.\aws-json-translator.exe translate-json -sf example.json -sl es -tl en

Run .jar

java -jar aws-json-translator.jar translate-json -sf example.json -sl es -tl en

This command will translate the file example.json from Spanish to English

Extended usage of "translate-json"


Run .exe

.\aws-json-translator.exe translate-json --sourceFile example.json --sourceLanguage es --targetLanguage en --formality formal --enableProfanityFilter --customTerminology list1,list2

Run .jar

java -jar aws-json-translator.jar translate-json --sourceFile example.json --sourceLanguage es --targetLanguage en --formality formal --enableProfanityFilter --customTerminology list1,list2

This command will translate the file example.json from Spanish to English with formality formal, with enabled profanity filter and a list of custom terminologies

  1. Done! Your translated JSON is on .\output folder with the target language code as name.

๐Ÿ‘ฉโ€๐Ÿ’ป Credits and used technologies

๐Ÿ’ผ License

MIT License

Copyright (c) 2022 Marc Guillem Dev

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

aws-json-translator-cli's People

Contributors

marcguillemdev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.