Updated translate-file.ps1

This commit is contained in:
Markus Fleschutz 2020-12-13 11:21:58 +00:00
parent 7709dc0ae1
commit 69c8c48203

View File

@ -11,15 +11,16 @@ if ($SourceFile -eq "" ) {
$SourceFile = read-host "Enter path to file" $SourceFile = read-host "Enter path to file"
} }
if ($SourceLanguage -eq "" ) { if ($SourceLanguage -eq "" ) {
$SourceLanguage = read-host "Enter source language" $SourceLanguage = read-host "Enter language of this file"
} }
if ($TargetLanguage -eq "" ) { if ($TargetLanguage -eq "" ) {
$TargetLanguage = read-host "Enter target language" $TargetLanguage = read-host "Enter language to translate to"
} }
try { try {
$ScriptPath=$MyInvocation.MyCommand.Path $PathToScript=(get-item $MyInvocation.MyCommand.Path).directory
$ScriptPath/trans -i $SourceFile -s $SourceLanguage -t $TargetLanguage -e google -brief $PathToScript="$PathToScript/trans"
Start-Process -FilePath $PathToScript -ArgumentList "-i $SourceFile -s $SourceLanguage -t $TargetLanguage -e google -brief" -NoNewWindow -Wait
exit 0 exit 0
} catch { } catch {
Write-Error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" Write-Error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"