From 6ab99d5ace2ebfbdcd209428333d2587a5e317ba Mon Sep 17 00:00:00 2001 From: MyDrift Date: Sat, 24 Aug 2024 14:02:24 +0200 Subject: [PATCH] add somewhat of a lang support (needs improvement) --- .../private/Invoke-WinUtilMicroWin-Helper.ps1 | 50 +++++++++++++++++++ functions/public/Invoke-WPFGetIso.ps1 | 2 +- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/functions/private/Invoke-WinUtilMicroWin-Helper.ps1 b/functions/private/Invoke-WinUtilMicroWin-Helper.ps1 index f3ffbd9c..95ecc877 100644 --- a/functions/private/Invoke-WinUtilMicroWin-Helper.ps1 +++ b/functions/private/Invoke-WinUtilMicroWin-Helper.ps1 @@ -25,6 +25,56 @@ function Test-CompatibleImage() { } } +function Get-FidoLangFromCulture { + + param ( + [Parameter(Mandatory, Position = 0)] [string] $langName + ) + + switch -Wildcard ($langName) + { + "ar*" { return "Arabic" } + "pt-BR" { return "Brazilian Portuguese" } + "bg*" { return "Bulgarian" } + {($_ -eq "zh-CH") -or ($_ -like "zh-Hans*") -or ($_ -eq "zh-SG") -or ($_ -eq "zh-CHS")} { return "Chinese (Simplified)" } + {($_ -eq "zh") -or ($_ -eq "zh-Hant") -or ($_ -eq "zh-HK") -or ($_ -eq "zh-MO") -or ($_ -eq "zh-TW") -or ($_ -eq "zh-CHT")} { return "Chinese (Traditional)" } + "hr*" { return "Croatian" } + "cs*" { return "Czech" } + "da*" { return "Danish" } + "nl*" { return "Dutch" } + "en-US" { return "English" } + {($_ -like "en*") -and ($_ -ne "en-US")} { return "English International" } + "et*" { return "Estonian" } + "fi*" { return "Finnish" } + {($_ -like "fr*") -and ($_ -ne "fr-CA")} { return "French" } + "fr-CA" { return "French Canadian" } + "de*" { return "German" } + "el*" { return "Greek" } + "he*" { return "Hebrew" } + "hu*" { return "Hungarian" } + "it*" { return "Italian" } + "ja*" { return "Japanese" } + "ko*" { return "Korean" } + "lv*" { return "Latvian" } + "lt*" { return "Lituanian" } + "nb*" { return "Norwegian" } + "pl*" { return "Polish" } + {($_ -like "pt*") -and ($_ -ne "pt-BR")} { return "Portuguese" } + "ro*" { return "Romanian" } + "ru*" { return "Russian" } + "sr-Latn*" { return "Serbian Latin" } + "sk*" { return "Slovak" } + "sl*" { return "Slovenian" } + {($_ -like "es*") -and ($_ -ne "es-MX")} { return "Spanish" } + "es-MX" { return "Spanish (Mexico)" } + "sv*" { return "Swedish" } + "th*" { return "Thai" } + "tr*" { return "Turkish" } + "uk*" { return "Ukrainian" } + default { return "English" } + } +} + function Remove-Features() { <# .SYNOPSIS diff --git a/functions/public/Invoke-WPFGetIso.ps1 b/functions/public/Invoke-WPFGetIso.ps1 index 72c262be..20a4e22a 100644 --- a/functions/public/Invoke-WPFGetIso.ps1 +++ b/functions/public/Invoke-WPFGetIso.ps1 @@ -86,7 +86,7 @@ function Invoke-WPFGetIso { # TODO: Have to correct the language to actually be a working one Set-Location -Path $env:temp - & $fidopath -Win 'Windows 11' -Rel $sync["ISORelease"].SelectedItem -Arch "x64" + & $fidopath -Win 'Windows 11' -Rel $sync["ISORelease"].SelectedItem -Arch "x64" -Lang "$(Get-FidoLangFromCulture -langName `"$($sync.ISOLanguage.SelectedItem)`")" Set-Location $originalLocation $filePath = Get-ChildItem -Path "$env:temp" -Filter "Win11*.iso" | Sort-Object LastWriteTime -Descending | Select-Object -First 1 }