From af856fe2f9d37aee9a48afd388eb7f94ed82dc15 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Mon, 12 Jun 2023 11:36:56 +0200 Subject: [PATCH] Update translate-files.ps1 --- Scripts/translate-files.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Scripts/translate-files.ps1 b/Scripts/translate-files.ps1 index cf974c12..4e317ef9 100755 --- a/Scripts/translate-files.ps1 +++ b/Scripts/translate-files.ps1 @@ -2,9 +2,9 @@ .SYNOPSIS Translates text files .DESCRIPTION - This PowerShell script translates text files into any supported language. -.PARAMETER FilePattern - Specifies the file pattern + This PowerShell script translates text files into multiple languages. +.PARAMETER filePattern + Specifies the file pattern of the text file(s) to be translated .EXAMPLE PS> ./translate-files C:\Temp\*.txt .LINK @@ -13,7 +13,7 @@ Author: Markus Fleschutz | License: CC0 #> -param([string]$FilePattern = "") +param([string]$filePattern = "") function DetectSourceLang { param([string]$Filename) if ("$Filename" -like "*Deutsch*") { return "de" } @@ -32,10 +32,10 @@ function TranslateFilename { param([string]$Filename, [string]$SourceLang, [stri } try { - if ($FilePattern -eq "" ) { $FilePattern = read-host "Enter the file pattern" } + if ($filePattern -eq "" ) { $filePattern = Read-Host "Enter the file pattern of the text file(s) to be translated" } $TargetLanguages = "ar","zh","fr","de","hi","ga","it","ja","ko","pt","ru","es" - $SourceFiles = get-childItem -path "$FilePattern" + $SourceFiles = Get-ChildItem -path "$filePattern" foreach($SourceFile in $SourceFiles) { $SourceLang = DetectSourceLang $SourceFile foreach($TargetLang in $TargetLanguages) {