Skip to content

Commit

Permalink
Use translated messages for the PS 3.0 prompt
Browse files Browse the repository at this point in the history
* Also use "Close" instead of "Cancel" for the initial 'Back' button
  • Loading branch information
pbatard committed Mar 12, 2019
1 parent bd94757 commit 4cebdef
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions Fido.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Fido v1.03 - Retail Windows ISO Downloader
# Fido v1.04 - Retail Windows ISO Downloader
# Copyright © 2019 Pete Batard <pete@akeo.ie>
# ConvertTo-ImageSource: Copyright © 2016 Chris Carter
#
Expand Down Expand Up @@ -85,13 +85,6 @@ Add-Type -AssemblyName PresentationFramework
[Gui.Utils]::ShowWindow(([System.Diagnostics.Process]::GetCurrentProcess() | Get-Process).MainWindowHandle, 0) | Out-Null
#endregion

# Make sure PowerShell 3.0 or later is used (for Invoke-WebRequest)
if ($PSVersionTable.PSVersion.Major -lt 3) {
Write-Host Error: PowerShell 3.0 or later is required to run this script.
[System.Windows.MessageBox]::Show("PowerShell 3.0 or later is required to run this script.`nYou can download it from: https://www.microsoft.com/en-us/download/details.aspx?id=34595", "Error", "OK", "Error") | Out-Null
exit -1
}

#region Data
$WindowsVersions = @(
@(
Expand Down Expand Up @@ -447,7 +440,9 @@ $UserAgent = "Mozilla/5.0 (X11; Linux i586; rv:$FirefoxVersion.0) Gecko/$Firefox
#endregion

# Localization
$EnglishMessages = "en-US|Version|Release|Edition|Language|Architecture|Download|Continue|Back|Close|Cancel|Error|Please wait...|Download using a browser|Temporarily banned by Microsoft for requesting too many downloads - Please try again later..."
$EnglishMessages = "en-US|Version|Release|Edition|Language|Architecture|Download|Continue|Back|Close|Cancel|Error|Please wait...|" +
"Download using a browser|Temporarily banned by Microsoft for requesting too many downloads - Please try again later...|" +
"PowerShell 3.0 or later is required to run this script.|Do you want to go online and download it?"
[string[]]$English = $EnglishMessages.Split('|')
[string[]]$Localized = $null
if ($LocData -and (-not $LocData.StartsWith("en-US"))) {
Expand All @@ -459,7 +454,17 @@ if ($LocData -and (-not $LocData.StartsWith("en-US"))) {
$Locale = $Localized[0]
}

# If asked, disable IE first run customize as it interferes with Invoke-WebRequest
# Make sure PowerShell 3.0 or later is used (for Invoke-WebRequest)
if ($PSVersionTable.PSVersion.Major -lt 3) {
Write-Host Error: PowerShell 3.0 or later is required to run this script.
$Msg = "$(Get-Translation($English[15]))`n$(Get-Translation($English[16]))"
if ([System.Windows.MessageBox]::Show($Msg, $(Get-Translation("Error")), "YesNo", "Error") -eq "Yes") {
Start-Process -FilePath https://www.microsoft.com/download/details.aspx?id=34595
}
exit -1
}

# If asked, disable IE's first run customize prompt as it interferes with Invoke-WebRequest
if ($DisableFirstRunCustomize) {
try {
# Only create the key if it doesn't already exist
Expand Down Expand Up @@ -487,7 +492,7 @@ if ($Locale.StartsWith("ar") -or $Locale.StartsWith("fa") -or $Locale.StartsWit
}
$WindowsVersionTitle.Text = Get-Translation("Version")
$Continue.Content = Get-Translation("Continue")
$Back.Content = Get-Translation("Cancel")
$Back.Content = Get-Translation("Close")

# Populate the Windows versions
$i = 0
Expand Down Expand Up @@ -747,7 +752,7 @@ $Back.add_click({
$Back.Margin = $Margin
$script:Stage = $Stage - 1
if ($Stage -eq 0) {
$Back.Content = Get-Translation("Cancel")
$Back.Content = Get-Translation("Close")
} elseif ($Stage -eq 3) {
$Continue.Content = Get-Translation("Continue")
}
Expand Down

0 comments on commit 4cebdef

Please sign in to comment.