@cutticat/libretranslate 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/README.md +11 -7
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -13,7 +13,9 @@ Library for working with the LibreTranslate API.
|
|
|
13
13
|
|
|
14
14
|
## Overview
|
|
15
15
|
|
|
16
|
-
The library provides the `translate` function for translating text via the LibreTranslate API.
|
|
16
|
+
The library provides the `translate` function for translating text via the LibreTranslate API.
|
|
17
|
+
Supports language auto-detection, alternative translations, custom baseUrl and API key. Uses Zod for
|
|
18
|
+
response validation and types from `@cutticat/types`.
|
|
17
19
|
|
|
18
20
|
## Installation
|
|
19
21
|
|
|
@@ -50,11 +52,13 @@ console.log(result.detectedLanguage) // { code: "fr", confidence: 0.95 }
|
|
|
50
52
|
|
|
51
53
|
### Functions
|
|
52
54
|
|
|
53
|
-
- `translate(options)` — translates text via the LibreTranslate API; returns
|
|
55
|
+
- `translate(options)` — translates text via the LibreTranslate API; returns
|
|
56
|
+
`Promise<TranslateResponse>`; throws `Error` on request failure
|
|
54
57
|
|
|
55
58
|
### Types
|
|
56
59
|
|
|
57
|
-
- `TranslationOptions` — translation parameters (`text`, `source`, `target`, `format?`,
|
|
60
|
+
- `TranslationOptions` — translation parameters (`text`, `source`, `target`, `format?`,
|
|
61
|
+
`alternatives?`, `baseUrl?`, `apiKey?`, `fetch?`)
|
|
58
62
|
- `TranslationFormat` — `"text"` | `"html"`
|
|
59
63
|
- `TranslateResponse` — response (`translatedText`, `detectedLanguage?`, `alternatives?`)
|
|
60
64
|
- `DetectedLanguage` — detected language info (`code`, `confidence`)
|
|
@@ -67,10 +71,10 @@ console.log(result.detectedLanguage) // { code: "fr", confidence: 0.95 }
|
|
|
67
71
|
|
|
68
72
|
Detailed documentation:
|
|
69
73
|
|
|
70
|
-
- [Project structure](documents/STRUCTURE.md)
|
|
71
|
-
- [Scripts](documents/SCRIPTS.md)
|
|
72
|
-
- [Style guide](documents/STYLE_GUIDE.md)
|
|
73
|
-
- [Contributing](documents/CONTRIBUTING.md)
|
|
74
|
+
- [Project structure](<https://gitflic.ru/project/cutticat-npm/libretranslate/blob?branch=main&file=documents/STRUCTURE.md>)
|
|
75
|
+
- [Scripts](<https://gitflic.ru/project/cutticat-npm/libretranslate/blob?branch=main&file=documents/SCRIPTS.md>)
|
|
76
|
+
- [Style guide](<https://gitflic.ru/project/cutticat-npm/libretranslate/blob?branch=main&file=documents/STYLE_GUIDE.md>)
|
|
77
|
+
- [Contributing](<https://gitflic.ru/project/cutticat-npm/libretranslate/blob?branch=main&file=documents/CONTRIBUTING.md>)
|
|
74
78
|
|
|
75
79
|
Full API documentation is available in JSDoc comments. Use IDE autocomplete to browse it.
|
|
76
80
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.4",
|
|
7
7
|
"description": "CuttiCat library for working with LibreTranslate",
|
|
8
8
|
"author": "Maksim Victorovich Fomin",
|
|
9
9
|
"repository": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@biomejs/biome": "^2.4.16",
|
|
32
|
+
"@cutticat/md-url-map": "^1.0.0",
|
|
32
33
|
"@types/node": "^25.9.1",
|
|
33
34
|
"rimraf": "^6.1.3",
|
|
34
35
|
"tsdown": "0.19.0-beta.2",
|