PowerShell to translate text with google translator API

How To

PowerShell to translate text with Google Translator Endpoint API without api key

i been working on some Bot to search around internet and find popular search terms across all countries and came across situation where the search terms were same but but difficult to compare due to different language.

I wanted to find some translator API like google translator API or Microsoft translator API but they work with token and come with some limitations so decided to find something without token of limitation. during search i came across google translator endpoint/api url without api key @ https://github.com/ssut/py-googletrans/issues/268

Below is sample code to translate and text via PowerShell:

GitHub – https://github.com/Ar-Sa/Arun/tree/master/Powershell/PowerShell%20to%20translate%20text%20with%20Google%20Translator%20Endpoint%20API%20without%20api%20key

function PS-Translate {
  param (

$Url = “https://translate.googleapis.com/translate_a/single?client=gtx&sl=$($SourceLanguage)&tl=$($TargetLanguage)&dt=t&q=$Text”
$Res = Invoke-RestMethod -Uri $Url -Method Get
$Translation = $Res[0].SyncRoot | foreach { $_[0] }
return $Translation
PS-Translate -SourceLanguage auto -TargetLanguage nl -Text “good morning”

(Visited 86 times, 1 visits today)