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

@steadycursor/i18n-gpt-translate

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@steadycursor/i18n-gpt-translate - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

src/program.ts

13

package.json
{
"name": "@steadycursor/i18n-gpt-translate",
"private": false,
"version": "0.0.1",
"version": "0.0.2",
"license": "MIT",

@@ -9,6 +9,11 @@ "main": "dist/index.js",

"types": "dist/index.d.ts",
"bin": {
"i18n-gpt-translate": "dist/program.js"
},
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --dts",
"start": "ts-node src/program.ts",
"build": "tsc --build",
"lint": "tsc",
"test": "vitest"
"test": "vitest",
"publish": "npm publish --access public"
},

@@ -20,2 +25,3 @@ "devDependencies": {

"typescript": "^5.4.5",
"ts-node": "^10.9.2",
"vitest": "^1.6.0"

@@ -26,2 +32,3 @@ },

"chatgpt": "^5.2.5",
"commander": "^12.1.0",
"flat": "^6.0.1",

@@ -28,0 +35,0 @@ "lodash": "^4.17.21",

@@ -5,3 +5,2 @@ import * as fs from "fs/promises";

import axios from "axios";
import { flatten, unflatten } from "flat";

@@ -11,6 +10,8 @@ type ARgs = {

defaultLanguage: string;
token: string;
};
export const main = async ({ localesPath, defaultLanguage }: ARgs) => {
export const main = async ({ localesPath, defaultLanguage, token }: ARgs) => {
if (!localesPath) {
console.log("Missing locales path");
return "dsadsa";

@@ -20,5 +21,11 @@ }

if (!defaultLanguage) {
console.log("Missing default language");
return "dsadsa";
}
if (!token) {
console.log("Missing token");
return "dsadsa";
}
const pathExists = await checkPath(localesPath);

@@ -56,2 +63,3 @@ console.log("Ahoj");

locales,
token,
});

@@ -66,2 +74,3 @@ }

locales: string[];
token: string;
}) => {

@@ -93,2 +102,3 @@ const namespaceFilePath = path.join(

data: defaultLocaleJson.data,
token: args.token,
});

@@ -103,2 +113,4 @@ }

const { flatten } = await import("flat");
const flattenData = flatten(data) as any;

@@ -118,2 +130,3 @@

data: { [key: string]: string | undefined };
token: string;
}) => {

@@ -134,3 +147,7 @@ const jsonPath = path.join(args.path, args.locale, args.namespace + ".json");

const translation = await translateJson(dataForTranslation, args.locale);
const translation = await translateJson(
dataForTranslation,
args.locale,
args.token
);

@@ -145,2 +162,4 @@ const updatedSourceData = _.merge(translation, json.data);

const { unflatten } = await import("flat");
const preparedJson = unflatten(sortedObject);

@@ -161,3 +180,3 @@

const translateJson = async (data: any, locale: string) => {
const translateJson = async (data: any, locale: string, token: string) => {
const response = await axios.post(

@@ -164,0 +183,0 @@ "https://api.openai.com/v1/chat/completions",

@@ -1,28 +0,1 @@

{
"all": "všechno",
"clear": "Vymazat",
"create": "Vytvořit",
"dangerZone": "Nebezpečná zóna",
"disabled": "Zakázáno",
"enabled": "Povoleno",
"filesRestrictions": "Pouze uživatelem vytvořené soubory",
"invalidFormValuesPresenterIsHidden": "Náhled není povolen. Nastavení kampaně má neplatné hodnoty.",
"items": {
"plural": "položky",
"singular": "položky"
},
"messages": {
"fetchError": "Nepodařilo se načíst data. Zkuste to prosím znovu."
},
"minutes": "minuty",
"noFilesRestrictions": "Všechny soubory",
"noRestrictions": "Bez omezení",
"offline": "Offline",
"online": "Online",
"preview": "Náhled",
"restrictions": "S omezením",
"seconds": "sekundy",
"show": "Ukázat",
"turnedOff": "Vypnuto",
"turnedOn": "Zapnuto"
}
{"items":{"plural":"položky"},"minutes":"minuty"}

@@ -195,2 +195,2 @@ {

"zIndex": "Pořadí"
}
}

@@ -28,2 +28,2 @@ {

"turnedOn": "Allumé"
}
}

@@ -195,2 +195,2 @@ {

"zIndex": "Z-Index"
}
}

@@ -28,2 +28,2 @@ {

"turnedOn": "Acceso"
}
}

@@ -195,2 +195,2 @@ {

"zIndex": "Indice Z"
}
}

@@ -9,2 +9,3 @@ import { expect, test } from "vitest";

defaultLanguage: "en",
token: "dsa",
})

@@ -11,0 +12,0 @@ ).toMatchInlineSnapshot(

@@ -6,8 +6,10 @@ {

"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"strict": true,
"skipLibCheck": true ,
"noUncheckedIndexedAccess": true,"noEmit": true
"noUncheckedIndexedAccess": true,"noEmit": true,
"outDir": "/dist"
}
}
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