local-translate-addon 1.0.3 → 1.0.4
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/index.d.ts +29 -0
- package/index.js +5 -1
- package/package.json +4 -4
package/index.d.ts
CHANGED
|
@@ -3,4 +3,33 @@
|
|
|
3
3
|
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
|
5
5
|
|
|
6
|
+
export const enum TranslateErrorCode {
|
|
7
|
+
UNSUPPORT_OS_VERSION = 'ERR_TRANSLATE_UNSUPPORTED_OS_VERSION',
|
|
8
|
+
LANGUAGE_PAIR_NOT_INSTALLED = 'ERR_TRANSLATE_LANGUAGE_PAIR_NOT_INSTALLED',
|
|
9
|
+
FAILED = 'ERR_TRANSLATE_FAILED'
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Translate text with the system's installed language models.
|
|
13
|
+
*
|
|
14
|
+
* Rejects with an Error whose code is one of:
|
|
15
|
+
* `ERR_TRANSLATE_UNSUPPORTED_OS_VERSION`,
|
|
16
|
+
* `ERR_TRANSLATE_LANGUAGE_PAIR_NOT_INSTALLED`, or `ERR_TRANSLATE_FAILED`.
|
|
17
|
+
*/
|
|
6
18
|
export declare function translateText(text: string, targetLang: string): Promise<unknown>
|
|
19
|
+
/**
|
|
20
|
+
* Request authorization to use speech recognition.
|
|
21
|
+
* Returns "authorized" | "denied" | "restricted" | "notDetermined".
|
|
22
|
+
*/
|
|
23
|
+
export declare function requestSpeechPermission(): Promise<unknown>
|
|
24
|
+
export interface SpeechRecognitionOptions {
|
|
25
|
+
onDeviceOnly?: boolean
|
|
26
|
+
}
|
|
27
|
+
/** Recognize speech from an audio file, optionally requiring the system's local model. */
|
|
28
|
+
export declare function recognizeSpeech(filePath: string, lang: string, options?: SpeechRecognitionOptions | undefined | null): Promise<unknown>
|
|
29
|
+
export interface SpeechRecognitionCapabilities {
|
|
30
|
+
isAvailable: boolean
|
|
31
|
+
supportsOnDeviceRecognition: boolean
|
|
32
|
+
isAuthorized: boolean
|
|
33
|
+
}
|
|
34
|
+
/** Check whether the selected locale currently supports system speech recognition. */
|
|
35
|
+
export declare function getSpeechRecognitionCapabilities(lang: string): SpeechRecognitionCapabilities
|
package/index.js
CHANGED
|
@@ -310,6 +310,10 @@ if (!nativeBinding) {
|
|
|
310
310
|
throw new Error(`Failed to load native binding`)
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
const { translateText } = nativeBinding
|
|
313
|
+
const { TranslateErrorCode, translateText, requestSpeechPermission, recognizeSpeech, getSpeechRecognitionCapabilities } = nativeBinding
|
|
314
314
|
|
|
315
|
+
module.exports.TranslateErrorCode = TranslateErrorCode
|
|
315
316
|
module.exports.translateText = translateText
|
|
317
|
+
module.exports.requestSpeechPermission = requestSpeechPermission
|
|
318
|
+
module.exports.recognizeSpeech = recognizeSpeech
|
|
319
|
+
module.exports.getSpeechRecognitionCapabilities = getSpeechRecognitionCapabilities
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "local-translate-addon",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "macOS Translation.framework via napi-rs",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@napi-rs/cli": "^2.18.4"
|
|
37
37
|
},
|
|
38
38
|
"optionalDependencies": {
|
|
39
|
-
"local-translate-addon-darwin-arm64": "1.0.
|
|
40
|
-
"local-translate-addon-darwin-x64": "1.0.
|
|
41
|
-
"local-translate-addon-darwin-universal": "1.0.
|
|
39
|
+
"local-translate-addon-darwin-arm64": "1.0.4",
|
|
40
|
+
"local-translate-addon-darwin-x64": "1.0.4",
|
|
41
|
+
"local-translate-addon-darwin-universal": "1.0.4"
|
|
42
42
|
}
|
|
43
43
|
}
|