mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-23 13:11:39 +01:00
Added translate-file.ps1
This commit is contained in:
parent
d9423bf219
commit
7dd4a9058e
@ -43,6 +43,7 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol
|
||||
* [take-screenshots.ps1](Scripts/take-screenshots.ps1) - takes multiple screenshots
|
||||
* [test.ps1](Scripts/test.ps1) - simple test script
|
||||
* [train-dns-cache.ps1](Scripts/train-dns-cache.ps1) - trains the DNS cache with frequently used domain names
|
||||
* [translate-file.ps1](Scripts/translate-file.ps1) - translates the given file from source to target language
|
||||
* [translate-text.ps1](Scripts/translate-text.ps1) - translates the given text into other languages
|
||||
* [txt2wav.ps1](Scripts/txt2wav.ps1) - converts text into a audio .WAV file
|
||||
* [validate-xml.ps1](Scripts/validate-xml.ps1) - validates the given XML file
|
||||
|
5693
Scripts/trans
Executable file
5693
Scripts/trans
Executable file
File diff suppressed because it is too large
Load Diff
26
Scripts/translate-file.ps1
Executable file
26
Scripts/translate-file.ps1
Executable file
@ -0,0 +1,26 @@
|
||||
#!/snap/bin/powershell
|
||||
|
||||
# Syntax: ./translate-file.ps1 [<file>]
|
||||
# Description: translates the given file from source to target language.
|
||||
# Author: Markus Fleschutz
|
||||
# Source: github.com/fleschutz/PowerShell
|
||||
# License: CC0
|
||||
|
||||
param([string]$SourceFile, [string]$SourceLanguage, [string]$TargetLanguage)
|
||||
if ($SourceFile -eq "" ) {
|
||||
$SourceFile = read-host "Enter path to file"
|
||||
}
|
||||
if ($SourceLanguage -eq "" ) {
|
||||
$SourceLanguage = read-host "Enter source language"
|
||||
}
|
||||
if ($TargetLanguage -eq "" ) {
|
||||
$TargetLanguage = read-host "Enter target language"
|
||||
}
|
||||
|
||||
try {
|
||||
./trans -i $SourceFile -s $SourceLanguage -t $TargetLanguage -e google -brief
|
||||
exit 0
|
||||
} catch {
|
||||
Write-Error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user