@lingo.dev/_sdk 0.10.1 → 0.11.0
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/build/index.cjs +20 -0
- package/build/index.d.cts +10 -0
- package/build/index.d.ts +10 -0
- package/build/index.mjs +20 -0
- package/package.json +4 -3
package/build/index.cjs
CHANGED
@@ -217,6 +217,26 @@ var LingoDotDevEngine = class {
|
|
217
217
|
);
|
218
218
|
return responses;
|
219
219
|
}
|
220
|
+
/**
|
221
|
+
* Localize an array of strings
|
222
|
+
* @param strings - An array of strings to be localized
|
223
|
+
* @param params - Localization parameters:
|
224
|
+
* - sourceLocale: The source language code (e.g., 'en')
|
225
|
+
* - targetLocale: The target language code (e.g., 'es')
|
226
|
+
* - fast: Optional boolean to enable fast mode (faster for bigger batches)
|
227
|
+
* @returns An array of localized strings in the same order
|
228
|
+
*/
|
229
|
+
async localizeStringArray(strings, params) {
|
230
|
+
const mapped = strings.reduce(
|
231
|
+
(acc, str, i) => {
|
232
|
+
acc[`item_${i}`] = str;
|
233
|
+
return acc;
|
234
|
+
},
|
235
|
+
{}
|
236
|
+
);
|
237
|
+
const result = await this.localizeObject(mapped, params);
|
238
|
+
return Object.values(result);
|
239
|
+
}
|
220
240
|
/**
|
221
241
|
* Localize a chat sequence while preserving speaker names
|
222
242
|
* @param chat - Array of chat messages, each with 'name' and 'text' properties
|
package/build/index.d.cts
CHANGED
@@ -118,6 +118,16 @@ declare class LingoDotDevEngine {
|
|
118
118
|
targetLocales: LocaleCode[];
|
119
119
|
fast?: boolean;
|
120
120
|
}, signal?: AbortSignal): Promise<string[]>;
|
121
|
+
/**
|
122
|
+
* Localize an array of strings
|
123
|
+
* @param strings - An array of strings to be localized
|
124
|
+
* @param params - Localization parameters:
|
125
|
+
* - sourceLocale: The source language code (e.g., 'en')
|
126
|
+
* - targetLocale: The target language code (e.g., 'es')
|
127
|
+
* - fast: Optional boolean to enable fast mode (faster for bigger batches)
|
128
|
+
* @returns An array of localized strings in the same order
|
129
|
+
*/
|
130
|
+
localizeStringArray(strings: string[], params: Z.infer<typeof localizationParamsSchema>): Promise<string[]>;
|
121
131
|
/**
|
122
132
|
* Localize a chat sequence while preserving speaker names
|
123
133
|
* @param chat - Array of chat messages, each with 'name' and 'text' properties
|
package/build/index.d.ts
CHANGED
@@ -118,6 +118,16 @@ declare class LingoDotDevEngine {
|
|
118
118
|
targetLocales: LocaleCode[];
|
119
119
|
fast?: boolean;
|
120
120
|
}, signal?: AbortSignal): Promise<string[]>;
|
121
|
+
/**
|
122
|
+
* Localize an array of strings
|
123
|
+
* @param strings - An array of strings to be localized
|
124
|
+
* @param params - Localization parameters:
|
125
|
+
* - sourceLocale: The source language code (e.g., 'en')
|
126
|
+
* - targetLocale: The target language code (e.g., 'es')
|
127
|
+
* - fast: Optional boolean to enable fast mode (faster for bigger batches)
|
128
|
+
* @returns An array of localized strings in the same order
|
129
|
+
*/
|
130
|
+
localizeStringArray(strings: string[], params: Z.infer<typeof localizationParamsSchema>): Promise<string[]>;
|
121
131
|
/**
|
122
132
|
* Localize a chat sequence while preserving speaker names
|
123
133
|
* @param chat - Array of chat messages, each with 'name' and 'text' properties
|
package/build/index.mjs
CHANGED
@@ -217,6 +217,26 @@ var LingoDotDevEngine = class {
|
|
217
217
|
);
|
218
218
|
return responses;
|
219
219
|
}
|
220
|
+
/**
|
221
|
+
* Localize an array of strings
|
222
|
+
* @param strings - An array of strings to be localized
|
223
|
+
* @param params - Localization parameters:
|
224
|
+
* - sourceLocale: The source language code (e.g., 'en')
|
225
|
+
* - targetLocale: The target language code (e.g., 'es')
|
226
|
+
* - fast: Optional boolean to enable fast mode (faster for bigger batches)
|
227
|
+
* @returns An array of localized strings in the same order
|
228
|
+
*/
|
229
|
+
async localizeStringArray(strings, params) {
|
230
|
+
const mapped = strings.reduce(
|
231
|
+
(acc, str, i) => {
|
232
|
+
acc[`item_${i}`] = str;
|
233
|
+
return acc;
|
234
|
+
},
|
235
|
+
{}
|
236
|
+
);
|
237
|
+
const result = await this.localizeObject(mapped, params);
|
238
|
+
return Object.values(result);
|
239
|
+
}
|
220
240
|
/**
|
221
241
|
* Localize a chat sequence while preserving speaker names
|
222
242
|
* @param chat - Array of chat messages, each with 'name' and 'text' properties
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lingo.dev/_sdk",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.11.0",
|
4
4
|
"description": "Lingo.dev JS SDK",
|
5
5
|
"private": false,
|
6
6
|
"publishConfig": {
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"@paralleldrive/cuid2": "^2.2.2",
|
22
22
|
"jsdom": "^25.0.1",
|
23
23
|
"zod": "^3.25.76",
|
24
|
-
"@lingo.dev/_spec": "0.39.
|
24
|
+
"@lingo.dev/_spec": "0.39.3"
|
25
25
|
},
|
26
26
|
"devDependencies": {
|
27
27
|
"@types/jsdom": "^21.1.7",
|
@@ -31,7 +31,8 @@
|
|
31
31
|
},
|
32
32
|
"scripts": {
|
33
33
|
"dev": "tsup --watch",
|
34
|
-
"build": "
|
34
|
+
"build": "pnpm typecheck && tsup",
|
35
|
+
"typecheck": "tsc --noEmit",
|
35
36
|
"test": "vitest run"
|
36
37
|
}
|
37
38
|
}
|