mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-21 23:41:01 +00:00
Update README.md
This commit is contained in:
parent
76721891b4
commit
cb6b324478
1 changed files with 33 additions and 1 deletions
34
README.md
34
README.md
|
@ -70,7 +70,7 @@ Response:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### HTML (beta)
|
### HTML
|
||||||
|
|
||||||
Request:
|
Request:
|
||||||
|
|
||||||
|
@ -97,6 +97,38 @@ Response:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Alternative Translations
|
||||||
|
|
||||||
|
Request:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const res = await fetch("https://libretranslate.com/translate", {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify({
|
||||||
|
q: "Hello",
|
||||||
|
source: "en",
|
||||||
|
target: "it",
|
||||||
|
format: "text",
|
||||||
|
alternatives: 3
|
||||||
|
}),
|
||||||
|
headers: { "Content-Type": "application/json" }
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(await res.json());
|
||||||
|
```
|
||||||
|
|
||||||
|
Response:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
"alternatives": [
|
||||||
|
"Salve",
|
||||||
|
"Pronto"
|
||||||
|
],
|
||||||
|
"translatedText": "Ciao"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Install and Run
|
## Install and Run
|
||||||
|
|
||||||
You can run your own API server with just a few lines of setup!
|
You can run your own API server with just a few lines of setup!
|
||||||
|
|
Loading…
Reference in a new issue