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

@adminforth/i18n

Package Overview
Dependencies
Maintainers
0
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adminforth/i18n - npm Package Compare versions

Comparing version 1.0.18-next.9 to 1.0.18-next.10

14

dist/index.js

@@ -293,2 +293,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

}
throw e;
}

@@ -349,5 +350,6 @@ process.env.HEAVY_DEBUG && console.log('🪲bulkTranslate done', translatedCount);

const lang = langIsoCode;
const langName = iso6391.getName(lang);
const requestSlavicPlurals = Object.keys(SLAVIC_PLURAL_EXAMPLES).includes(lang) && plurals;
const prompt = `
I need to translate strings in JSON to ${lang} language from English for my web app.
I need to translate strings in JSON to ${lang} (${langName}) language from English for my web app.
${requestSlavicPlurals ? `You should provide 4 translations (in format zero | singular | 2-4 | 5+) e.g. ${SLAVIC_PLURAL_EXAMPLES[lang]}` : ''}

@@ -380,6 +382,12 @@ Keep keys, as is, write translation into values! Here are the strings:

catch (e) {
console.error(`Error in parsing OpenAI: ${resp}\n Prompt was: ${prompt}\n Resp was: ${JSON.stringify(resp)}`);
console.error(`Error in parsing LLM resp: ${resp}\n Prompt was: ${prompt}\n Resp was: ${JSON.stringify(resp)}`);
return [];
}
res = JSON.parse(res);
try {
res = JSON.parse(res);
}
catch (e) {
console.error(`Error in parsing LLM resp json: ${resp}\n Prompt was: ${prompt}\n Resp was: ${JSON.stringify(resp)}`);
return [];
}
for (const [enStr, translatedStr] of Object.entries(res)) {

@@ -386,0 +394,0 @@ const translationsTargeted = translations.filter(t => t[this.enFieldName] === enStr);

@@ -335,3 +335,4 @@ import AdminForth, { AdminForthPlugin, Filters, suggestIfTypo, AdminForthDataTypes } from "adminforth";

return { ok: false, error: e.message };
}
}
throw e;
}

@@ -399,7 +400,7 @@ process.env.HEAVY_DEBUG && console.log('🪲bulkTranslate done', translatedCount);

const lang = langIsoCode;
const langName = iso6391.getName(lang);
const requestSlavicPlurals = Object.keys(SLAVIC_PLURAL_EXAMPLES).includes(lang) && plurals;
const prompt = `
I need to translate strings in JSON to ${lang} language from English for my web app.
I need to translate strings in JSON to ${lang} (${langName}) language from English for my web app.
${requestSlavicPlurals ? `You should provide 4 translations (in format zero | singular | 2-4 | 5+) e.g. ${SLAVIC_PLURAL_EXAMPLES[lang]}` : ''}

@@ -416,3 +417,3 @@ Keep keys, as is, write translation into values! Here are the strings:

\`\`\`
`;
`;

@@ -443,7 +444,14 @@ // process.env.HEAVY_DEBUG && console.log('🧠 llm prompt', prompt);

} catch (e) {
console.error(`Error in parsing OpenAI: ${resp}\n Prompt was: ${prompt}\n Resp was: ${JSON.stringify(resp)}`, );
console.error(`Error in parsing LLM resp: ${resp}\n Prompt was: ${prompt}\n Resp was: ${JSON.stringify(resp)}`, );
return [];
}
res = JSON.parse(res);
try {
res = JSON.parse(res);
} catch (e) {
console.error(`Error in parsing LLM resp json: ${resp}\n Prompt was: ${prompt}\n Resp was: ${JSON.stringify(resp)}`, );
return [];
}
for (const [enStr, translatedStr] of Object.entries(res) as [string, string][]) {

@@ -450,0 +458,0 @@ const translationsTargeted = translations.filter(t => t[this.enFieldName] === enStr);

{
"name": "@adminforth/i18n",
"version": "1.0.18-next.9",
"version": "1.0.18-next.10",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "types": "dist/index.d.ts",

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