New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ai-translator

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ai-translator

A utility that translates JSON or CSV files using OpenAI's API

  • 1.0.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

ai-translator.js

A utility that translates JSON or CSV files using OpenAI's API.

Usage

npx @axeptio/ai-translator "./to/translate/*.json" "./translated/{filename}_{locale}.json"  

Arguments and options

Arguments:
  input                                  Input file or directory
  output                                 Output file or directory

Options:
  -f, --format <format>                  Format (csv, json) (default: null)
  -l, --locales <locales>                Locales to translate to (default: null)
  -s, --separator <separator>            Separator for CSV files (default: "auto")
  -e, --encoding <encoding>              Encoding for CSV files (default: "utf8")
  -k, --apiKey <apiKey>                  OpenAI API key
  -v, --verbose                          Verbose mode (default: false)
  -j, --jobDescription <jobDescription>  Job description file (default: null)
  -h, --help                             display help for command

Interactively

When using the CLI interactively, you will be prompted for the following information:

  • Translation context: write in plain english context information to guide the AI (e.g. "This is marketing material for a landing page")
  • Writing style: give precise guidelines for the AI to work with.
  • Output locales: a list of locales you want to translate to
  • Protected fields: a list of fields that should not be translated (e.g. "name", "icon", "slug", etc.)
  • Field descriptions: a list of fields that require specific instructions (e.g. "title should not exceed 90 characters", etc.)

When using the CLI interactively, you will be asked if you want to save these presets as a job description. If you do, you will be prompted for a name for the job options and a destination folder.

Job Options

If you are processing the same file multiple times, you can save the job options in a JSON file and use it as a template for future runs. The job options file should respect the JSON schema in the src directory, and look like this:

{
  "format": "json",
  "context": "This is marketing material for a landing page",
  "style": "Formal",
  "locales": ["fr", "de", "es"],
  "protectedFields": ["name", "icon", "slug"]
}

FAQs

Package last updated on 26 Apr 2023

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