@things-factory/codelingua 10.1.145 → 10.1.147
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-server/controllers/i18n-completion.js +1 -1
- package/dist-server/controllers/i18n-completion.js.map +1 -1
- package/dist-server/service/i18n-completion/i18n-completion-type.d.ts +1 -1
- package/dist-server/service/i18n-completion/i18n-completion-type.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/translations/es.json +1 -0
|
@@ -11,7 +11,7 @@ exports.i18nCompletion = i18nCompletion;
|
|
|
11
11
|
const ai_client_1 = require("./ai-client");
|
|
12
12
|
const FALLBACK_MESSAGE = 'The Code Lingua service is currently unavailable. Please contact your system administrator.';
|
|
13
13
|
const DEFAULT_SOURCE_LOCALE = 'ko';
|
|
14
|
-
const DEFAULT_TARGET_LOCALES = ['en', 'ja', 'zh', 'ms'];
|
|
14
|
+
const DEFAULT_TARGET_LOCALES = ['en', 'ja', 'zh', 'ms', 'es'];
|
|
15
15
|
const SYSTEM_PROMPT = `You are a translation assistant. You receive a JSON object of i18n key-value pairs in a single source locale, and produce equivalent JSON objects for the requested target locales.
|
|
16
16
|
|
|
17
17
|
Output strictly as a single JSON object whose top-level keys are the target locale codes, and each value is a translated JSON object preserving the EXACT same key structure as the source. Translate values only — never translate keys. Preserve placeholders like {{name}}, %{var}, {0} verbatim. No commentary, no explanation, no markdown — JSON only.`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n-completion.js","sourceRoot":"","sources":["../../server/controllers/i18n-completion.ts"],"names":[],"mappings":";;AAkBA,wCAgCC;AAlDD;;;;;;GAMG;AACH,2CAAiD;AAEjD,MAAM,gBAAgB,GAAG,6FAA6F,CAAA;AAEtH,MAAM,qBAAqB,GAAG,IAAI,CAAA;AAClC,MAAM,sBAAsB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA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D,OAAO,gBAAgB,CAAA;IACzB,CAAC;AACH,CAAC","sourcesContent":["/**\n * i18n JSON 자동 번역 — 원본 JSON + 원본 locale + 대상 locale 배열을 받아서 같은 키\n * 구조로 다국어 JSON 묶음을 생성.\n *\n * 이전 hardcoded \"ko → en/ja/zh/ms\" 에서 source/target 동적 파라미터로 일반화.\n * provider-agnostic (ai-client-base).\n */\nimport { getCodelinguaClient } from './ai-client'\n\nconst FALLBACK_MESSAGE = 'The Code Lingua service is currently unavailable. Please contact your system administrator.'\n\nconst DEFAULT_SOURCE_LOCALE = 'ko'\nconst DEFAULT_TARGET_LOCALES = ['en', 'ja', 'zh', 'ms', 'es']\n\nconst SYSTEM_PROMPT = `You are a translation assistant. You receive a JSON object of i18n key-value pairs in a single source locale, and produce equivalent JSON objects for the requested target locales.\n\nOutput strictly as a single JSON object whose top-level keys are the target locale codes, and each value is a translated JSON object preserving the EXACT same key structure as the source. Translate values only — never translate keys. Preserve placeholders like {{name}}, %{var}, {0} verbatim. No commentary, no explanation, no markdown — JSON only.`\n\nexport async function i18nCompletion({\n json,\n sourceLocale,\n targetLocales\n}: {\n json: string\n sourceLocale?: string\n targetLocales?: string[]\n}): Promise<string> {\n try {\n const src = sourceLocale && sourceLocale.length > 0 ? sourceLocale : DEFAULT_SOURCE_LOCALE\n const targets =\n targetLocales && targetLocales.length > 0 ? targetLocales : DEFAULT_TARGET_LOCALES\n\n const userMsg =\n `Source locale: ${src}\\n` +\n `Target locales: ${JSON.stringify(targets)}\\n` +\n `Source JSON:\\n${json}`\n\n const client = getCodelinguaClient()\n const reply = await client.chat(\n [{ role: 'user', content: userMsg }],\n {\n systemPrompt: SYSTEM_PROMPT,\n temperature: 0.2 // 번역은 일관성 우선\n }\n )\n return reply || FALLBACK_MESSAGE\n } catch (error) {\n console.error('[codelingua] i18nCompletion failed:', error)\n return FALLBACK_MESSAGE\n }\n}\n"]}
|
|
@@ -8,7 +8,7 @@ export declare class i18nCompletionInput {
|
|
|
8
8
|
sourceLocale?: string;
|
|
9
9
|
/**
|
|
10
10
|
* 번역할 대상 언어 코드 배열. 예: ['en', 'ja', 'zh', 'ms'].
|
|
11
|
-
* 미지정 시 ['en', 'ja', 'zh', 'ms'] (codelingua 의 historical default).
|
|
11
|
+
* 미지정 시 ['en', 'ja', 'zh', 'ms', 'es'] (codelingua 의 historical default).
|
|
12
12
|
*/
|
|
13
13
|
targetLocales?: string[];
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n-completion-type.js","sourceRoot":"","sources":["../../../server/service/i18n-completion/i18n-completion-type.ts"],"names":[],"mappings":";;;;AAAA,+CAA2D;AAGpD,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;CAkB/B,CAAA;AAlBY,kDAAmB;AAG9B;IADC,IAAA,oBAAK,GAAE;;iDACK;AAOb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yDACL;AAOrB;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0DAClB;8BAjBb,mBAAmB;IAD/B,IAAA,wBAAS,GAAE;GACC,mBAAmB,CAkB/B;AAGM,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;CAGhC,CAAA;AAHY,oDAAoB;AAE/B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACV;+BAFL,oBAAoB;IADhC,IAAA,yBAAU,GAAE;GACA,oBAAoB,CAGhC","sourcesContent":["import { ObjectType, Field, InputType } from 'type-graphql'\n\n@InputType()\nexport class i18nCompletionInput {\n /** Source JSON (key-value pairs). 보통 한 언어로 작성된 i18n 파일 내용. */\n @Field()\n json!: string\n\n /**\n * 원본 언어 BCP-47 코드. 예: 'ko', 'en', 'ja'.\n * 미지정 시 'ko' (codelingua 의 historical default).\n */\n @Field({ nullable: true })\n sourceLocale?: string\n\n /**\n * 번역할 대상 언어 코드 배열. 예: ['en', 'ja', 'zh', 'ms'].\n * 미지정 시 ['en', 'ja', 'zh', 'ms'] (codelingua 의 historical default).\n */\n @Field(() => [String], { nullable: true })\n targetLocales?: string[]\n}\n\n@ObjectType()\nexport class i18nCompletionOutput {\n @Field({ nullable: true })\n message?: string\n}\n"]}
|
|
1
|
+
{"version":3,"file":"i18n-completion-type.js","sourceRoot":"","sources":["../../../server/service/i18n-completion/i18n-completion-type.ts"],"names":[],"mappings":";;;;AAAA,+CAA2D;AAGpD,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;CAkB/B,CAAA;AAlBY,kDAAmB;AAG9B;IADC,IAAA,oBAAK,GAAE;;iDACK;AAOb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yDACL;AAOrB;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0DAClB;8BAjBb,mBAAmB;IAD/B,IAAA,wBAAS,GAAE;GACC,mBAAmB,CAkB/B;AAGM,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;CAGhC,CAAA;AAHY,oDAAoB;AAE/B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACV;+BAFL,oBAAoB;IADhC,IAAA,yBAAU,GAAE;GACA,oBAAoB,CAGhC","sourcesContent":["import { ObjectType, Field, InputType } from 'type-graphql'\n\n@InputType()\nexport class i18nCompletionInput {\n /** Source JSON (key-value pairs). 보통 한 언어로 작성된 i18n 파일 내용. */\n @Field()\n json!: string\n\n /**\n * 원본 언어 BCP-47 코드. 예: 'ko', 'en', 'ja'.\n * 미지정 시 'ko' (codelingua 의 historical default).\n */\n @Field({ nullable: true })\n sourceLocale?: string\n\n /**\n * 번역할 대상 언어 코드 배열. 예: ['en', 'ja', 'zh', 'ms'].\n * 미지정 시 ['en', 'ja', 'zh', 'ms', 'es'] (codelingua 의 historical default).\n */\n @Field(() => [String], { nullable: true })\n targetLocales?: string[]\n}\n\n@ObjectType()\nexport class i18nCompletionOutput {\n @Field({ nullable: true })\n message?: string\n}\n"]}
|