@translated/lara 1.1.0 → 1.2.1
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/lib/sdk-version.d.ts +1 -1
- package/lib/sdk-version.js +1 -1
- package/lib/translator/translator.d.ts +3 -1
- package/lib/translator/translator.js +5 -3
- package/package.json +1 -1
- package/lib/_test.d.ts +0 -1
- package/lib/_test.js +0 -14
package/lib/sdk-version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.1
|
|
1
|
+
export declare const version = "1.2.1";
|
package/lib/sdk-version.js
CHANGED
|
@@ -29,9 +29,11 @@ export type TranslateOptions = {
|
|
|
29
29
|
multiline?: boolean;
|
|
30
30
|
timeoutInMillis?: number;
|
|
31
31
|
priority?: "normal" | "background";
|
|
32
|
+
useCache?: boolean | "overwrite";
|
|
33
|
+
cacheTTLSeconds?: number;
|
|
32
34
|
};
|
|
33
35
|
export declare class Translator {
|
|
34
|
-
|
|
36
|
+
protected readonly client: LaraClient;
|
|
35
37
|
readonly memories: Memories;
|
|
36
38
|
constructor(credentials: Credentials, options?: TranslatorOptions);
|
|
37
39
|
getLanguages(): Promise<string[]>;
|
|
@@ -112,9 +112,11 @@ class Translator {
|
|
|
112
112
|
}
|
|
113
113
|
async translate(text, source, target, options) {
|
|
114
114
|
return await this.client.post("/translate", {
|
|
115
|
-
q: text, source, target, source_hint: options === null || options === void 0 ? void 0 : options.sourceHint,
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
q: text, source, target, source_hint: options === null || options === void 0 ? void 0 : options.sourceHint,
|
|
116
|
+
content_type: options === null || options === void 0 ? void 0 : options.contentType, multiline: (options === null || options === void 0 ? void 0 : options.multiline) !== false,
|
|
117
|
+
adapt_to: options === null || options === void 0 ? void 0 : options.adaptTo, instructions: options === null || options === void 0 ? void 0 : options.instructions,
|
|
118
|
+
timeout: options === null || options === void 0 ? void 0 : options.timeoutInMillis, priority: options === null || options === void 0 ? void 0 : options.priority,
|
|
119
|
+
use_cache: options === null || options === void 0 ? void 0 : options.useCache, cache_ttl: options === null || options === void 0 ? void 0 : options.cacheTTLSeconds
|
|
118
120
|
});
|
|
119
121
|
}
|
|
120
122
|
}
|
package/package.json
CHANGED
package/lib/_test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/_test.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const translator_1 = require("./translator/translator");
|
|
4
|
-
const credentials_1 = require("./credentials");
|
|
5
|
-
async function main() {
|
|
6
|
-
const credentials = new credentials_1.Credentials("7GAFEDT3LDJAJH9HFA1CDJULDU", "EBXxbk71Mx6yR9YG48f1jDyY4s5QQLOff0GcTw2QlfY");
|
|
7
|
-
const translator = new translator_1.Translator(credentials, {
|
|
8
|
-
serverUrl: "http://localhost:8000/"
|
|
9
|
-
});
|
|
10
|
-
console.log(await translator.translate("This is a test.", "en", "it", {
|
|
11
|
-
priority: "background"
|
|
12
|
-
}));
|
|
13
|
-
}
|
|
14
|
-
main().catch(console.error);
|