mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-11-25 23:16:15 +01:00
Add support links for Ukraine in Russian language (#910)
This commit is contained in:
@@ -21,6 +21,53 @@ function Update-WindowLanguageResources {
|
||||
$text = Get-Translation -Key $key -Section 'Chrome'
|
||||
foreach ($target in $targets) { $target.Resources["Language_$key"] = $text }
|
||||
}
|
||||
Set-SupportLinkIcon -Icon $Window.FindName('KofiIcon')
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Returns the support destination for the active interface language.
|
||||
#>
|
||||
function Get-SupportLinkUrl {
|
||||
if ($script:Lang.LanguageCode -eq 'ru-RU') {
|
||||
return 'https://war.ukraine.ua/support-ukraine/'
|
||||
}
|
||||
return 'https://ko-fi.com/raphire'
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Shows the Ukrainian flag for Russian, or the creator support heart otherwise.
|
||||
|
||||
.PARAMETER Icon
|
||||
The support link's icon TextBlock, when present in the window.
|
||||
#>
|
||||
function Set-SupportLinkIcon {
|
||||
param([System.Windows.Controls.TextBlock]$Icon)
|
||||
|
||||
if ($null -eq $Icon) { return }
|
||||
if ($script:Lang.LanguageCode -eq 'ru-RU') {
|
||||
# Draw the flag directly so it also renders on Windows without flag emoji support.
|
||||
$drawing = [System.Windows.Media.DrawingGroup]::new()
|
||||
foreach ($stripe in @(
|
||||
@{ Color = '#0057B7'; Y = 0 }
|
||||
@{ Color = '#FFD700'; Y = 1 }
|
||||
)) {
|
||||
$brush = [System.Windows.Media.BrushConverter]::new().ConvertFromString($stripe.Color)
|
||||
$rectangle = [System.Windows.Media.RectangleGeometry]::new([System.Windows.Rect]::new(0, $stripe.Y, 3, 1))
|
||||
$drawing.Children.Add([System.Windows.Media.GeometryDrawing]::new($brush, $null, $rectangle))
|
||||
}
|
||||
$Icon.Text = ''
|
||||
$Icon.Width = 18
|
||||
$Icon.Height = 12
|
||||
$Icon.Background = [System.Windows.Media.DrawingBrush]::new($drawing)
|
||||
}
|
||||
else {
|
||||
$Icon.Text = [string][char]0xEB52
|
||||
$Icon.ClearValue([System.Windows.FrameworkElement]::WidthProperty)
|
||||
$Icon.ClearValue([System.Windows.FrameworkElement]::HeightProperty)
|
||||
$Icon.ClearValue([System.Windows.Controls.TextBlock]::BackgroundProperty)
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
|
||||
@@ -57,6 +57,7 @@ function Show-AboutDialog {
|
||||
$versionText = $aboutWindow.FindName('VersionText')
|
||||
$projectLink = $aboutWindow.FindName('ProjectLink')
|
||||
$kofiLink = $aboutWindow.FindName('KofiLink')
|
||||
Set-SupportLinkIcon -Icon $aboutWindow.FindName('KofiLinkIcon')
|
||||
$closeButton = $aboutWindow.FindName('CloseButton')
|
||||
|
||||
# Set version
|
||||
@@ -72,9 +73,9 @@ function Show-AboutDialog {
|
||||
Start-Process "https://github.com/Raphire/Win11Debloat"
|
||||
})
|
||||
|
||||
# Ko-fi link click handler
|
||||
# Support link click handler
|
||||
$kofiLink.Add_Click({
|
||||
Start-Process "https://ko-fi.com/raphire"
|
||||
Start-Process (Get-SupportLinkUrl)
|
||||
})
|
||||
|
||||
# Close button handler
|
||||
|
||||
@@ -70,6 +70,7 @@ function Show-ApplyModal {
|
||||
$applyRebootList = $applyWindow.FindName('ApplyRebootList')
|
||||
$applyCloseBtn = $applyWindow.FindName('ApplyCloseBtn')
|
||||
$applyKofiBtn = $applyWindow.FindName('ApplyKofiBtn')
|
||||
Set-SupportLinkIcon -Icon $applyWindow.FindName('ApplyKofiIcon')
|
||||
$applyCancelBtn = $applyWindow.FindName('ApplyCancelBtn')
|
||||
|
||||
# Initialize in-progress state
|
||||
@@ -242,7 +243,7 @@ function Show-ApplyModal {
|
||||
if ($script:ApplyModalInErrorState) {
|
||||
Start-Process "https://github.com/Raphire/Win11Debloat/issues/new"
|
||||
} else {
|
||||
Start-Process "https://ko-fi.com/raphire"
|
||||
Start-Process (Get-SupportLinkUrl)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ function Show-MainWindow {
|
||||
})
|
||||
|
||||
# ---- Menu/button event wiring ----
|
||||
$kofiBtn.Add_Click({ Start-Process "https://ko-fi.com/raphire" })
|
||||
$kofiBtn.Add_Click({ Start-Process (Get-SupportLinkUrl) })
|
||||
$window.FindName('SettingsBtn').Add_Click({ Open-MainWindowSettings -Window $window })
|
||||
|
||||
$menuBtn.Add_Click({
|
||||
|
||||
Reference in New Issue
Block a user