
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@axeptio/ai-translator
Advanced tools
A utility that translates JSON or CSV files using OpenAI's API
A utility that translates JSON or CSV files using OpenAI's API.
npx @axeptio/ai-translator "./to/translate/*.json" "./translated/{filename}_{locale}.json"
You will need Open AI credentials to use this tool. You can get them here.
This project uses dotenv
. To set your credentials, create a .env
file at the root of the project and add the following:
OPENAI_API_KEY=YOUR_API_KEY
OPENAI_ORGANIZATION_ID=YOUR_ORGANIZATION_ID
If you are using the tool in a CI environment, you can also set the credentials using environment variables. If you use the
--apiKey
and --organizationId
options, they will override the values set in the .env
file. Finally, when using the interactive mode, you will be asked to enter your credentials if they can not be found.
Usage: AI Translator translate [options] <input> <outputPattern>
Takes a file or directory and translates its content
Arguments:
input Input file or directory
outputPattern Output pattern for the translated files (e.g. {filename}-{locale}.{ext})
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 (default: null)
-o, --organizationId <organizationId> OpenAI Organization ID (default: null)
-v, --verbose Verbose mode (default: false)
-j, --jobOptions <jobOptions> Job description file (default: null)
-h, --help display help for command
When using the CLI interactively, you will be prompted for the following information:
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.
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"]
}
You can also use the tool programmatically. Here is an example:
// if you are using dotenv
import * as dotenv from "dotenv";
dotenv.config();
const { translate } = require('@axeptio/ai-translator');
const input = {
"title": "This is a title",
"description": "This is a description",
"tags": ["do", "not", "translate"],
"nested": {
"title": "This is a nested title",
"description": "This is a nested description"
},
"list":[
{ "firstname": "John", "lastname": "Doe", "role": "CEO" },
{ "firstname": "Jane", "lastname": "Doe", role: "Software Engineer" }
],
"isLive": true
};
const options = {
context: "This is marketing material for a landing page",
style: "Formal",
locales: ["fr", "de", "es"],
openAIConfigurationParameters: {
apiKey: process.env.OPENAI_API_KEY,
organizationId: process.env.OPENAI_ORGANIZATION_ID
},
// optional parameters
protectedFields: ["tags", "list.*.firstname", "list.*.firstname"],
delayMs: 5000,
verbose: false,
temperature: 1,
model: "gpt-3.5-turbo",
}
const translated = await translate(input, options);
console.info(translated);
--dry-run
optiontranslate
functionnpx
is not working in the working directoryFAQs
A utility that translates JSON or CSV files using OpenAI's API
We found that @axeptio/ai-translator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.