Update the translate-*.ps1 scripts

This commit is contained in:
Markus Fleschutz
2023-06-30 22:18:13 +02:00
parent 44ad2aecf8
commit 1dbc01e8a3
3 changed files with 28 additions and 19 deletions

View File

@ -21,7 +21,7 @@ param([string]$Text = "", [string]$SourceLangCode = "en", [string]$TargetLangCod
function UseLibreTranslate { param([string]$Text, [string]$SourceLangCode, [string]$TargetLangCode)
$Parameters = @{"q"="$Text"; "source"="$SourceLangCode"; "target"="$TargetLangCode"; }
$Result = (Invoke-WebRequest -Uri https://translate.mentality.rip/translate -Method POST -Body ($Parameters|ConvertTo-Json) -ContentType "application/json" -useBasicParsing).content | ConvertFrom-Json
$Result = (Invoke-WebRequest -Uri https://libretranslate.de/translate -Method POST -Body ($Parameters|ConvertTo-Json) -ContentType "application/json" -useBasicParsing).content | ConvertFrom-Json
return $Result.translatedText
}