Add support links for Ukraine in Russian language (#910)

This commit is contained in:
Jeffrey
2026-11-15 17:26:58 +01:00
committed by GitHub
parent 30c4a8efed
commit 3d8feefbbc
9 changed files with 80 additions and 12 deletions
+5 -5
View File
@@ -4,7 +4,7 @@
"MessageBoxCancel": "Отмена", "MessageBoxCancel": "Отмена",
"MessageBoxYes": "Да", "MessageBoxYes": "Да",
"MessageBoxNo": "Нет", "MessageBoxNo": "Нет",
"TitleBarSupportCreator": "Поддержать автора", "TitleBarSupportCreator": "Поддержать Украину",
"TitleBarOptions": "Параметры", "TitleBarOptions": "Параметры",
"SettingsTitle": "Параметры", "SettingsTitle": "Параметры",
"SettingsSave": "Сохранить", "SettingsSave": "Сохранить",
@@ -108,8 +108,8 @@
"AboutVersionLabel": "Версия:", "AboutVersionLabel": "Версия:",
"AboutAuthorLabel": "Автор:", "AboutAuthorLabel": "Автор:",
"AboutProjectLabel": "Проект:", "AboutProjectLabel": "Проект:",
"AboutDonationMessage": "Я с увлечением развиваю Win11Debloat в свободное время. Если программа оказалась вам полезной, пожалуйста, поддержите ее развитие небольшим пожертвованием. Я буду очень признателен!", "AboutDonationMessage": "Я с увлечением развиваю Win11Debloat в свободное время. Если программа оказалась вам полезной, пожалуйста, помогите Украине защититься от российской агрессии, сделав пожертвование по ссылке ниже. Спасибо за вашу поддержку!",
"AboutKofiLink": "Поддержать меня на Ko-fi", "AboutKofiLink": "Поддержать Украину",
"AppSelectionWindowTitle": "Win11Debloat: выбор приложений", "AppSelectionWindowTitle": "Win11Debloat: выбор приложений",
"AppSelectionWindowInstructions": "Установите флажки для приложений, которые нужно удалить, и снимите их для приложений, которые нужно оставить", "AppSelectionWindowInstructions": "Установите флажки для приложений, которые нужно удалить, и снимите их для приложений, которые нужно оставить",
"AppSelectionWindowCheckAll": "Отметить или снять все флажки", "AppSelectionWindowCheckAll": "Отметить или снять все флажки",
@@ -123,7 +123,7 @@
"ApplyCreatingRegistryBackup": "Создание резервной копии реестра...", "ApplyCreatingRegistryBackup": "Создание резервной копии реестра...",
"ApplyCreatingRestorePoint": "Создание точки восстановления системы. Это может занять некоторое время...", "ApplyCreatingRestorePoint": "Создание точки восстановления системы. Это может занять некоторое время...",
"ApplyCompletionTitleSuccess": "Изменения применены", "ApplyCompletionTitleSuccess": "Изменения применены",
"ApplyCompletionMessageDefault": "Обратите внимание: некоторые изменения вступят в силу только после перезагрузки. Спасибо, что пользуетесь Win11Debloat!", "ApplyCompletionMessageDefault": "Обратите внимание: некоторые изменения вступят в силу только после перезагрузки. Спасибо, что пользуетесь Win11Debloat!\n\nАгрессия России против Украины привела к гибели тысяч людей. Поддержите Украину в защите своей страны, воспользовавшись ссылкой ниже.",
"ApplyRebootRequiredHeader": "Чтобы эти изменения вступили в силу, требуется перезагрузка:", "ApplyRebootRequiredHeader": "Чтобы эти изменения вступили в силу, требуется перезагрузка:",
"ApplyRebootRequiredWingetDeferred": "Удаление приложения {0}", "ApplyRebootRequiredWingetDeferred": "Удаление приложения {0}",
"ApplyCompletionTitleCancelled": "Отменено", "ApplyCompletionTitleCancelled": "Отменено",
@@ -136,7 +136,7 @@
"ApplyCompletionMessageFailures_few": "Не удалось применить {0} изменения. Дополнительные сведения см. в консоли.", "ApplyCompletionMessageFailures_few": "Не удалось применить {0} изменения. Дополнительные сведения см. в консоли.",
"ApplyCompletionMessageFailures_many": "Не удалось применить {0} изменений. Дополнительные сведения см. в консоли.", "ApplyCompletionMessageFailures_many": "Не удалось применить {0} изменений. Дополнительные сведения см. в консоли.",
"ApplyCompletionMessageFailures_other": "Не удалось применить {0} изменений. Дополнительные сведения см. в консоли.", "ApplyCompletionMessageFailures_other": "Не удалось применить {0} изменений. Дополнительные сведения см. в консоли.",
"ApplyCompletionMessageReady": "Система готова. Спасибо, что пользуетесь Win11Debloat!", "ApplyCompletionMessageReady": "Система готова. Спасибо, что пользуетесь Win11Debloat!\n\nАгрессия России против Украины привела к гибели тысяч людей. Поддержите Украину в защите своей страны, воспользовавшись ссылкой ниже.",
"ApplyCompletionTitleError": "Ошибка", "ApplyCompletionTitleError": "Ошибка",
"ApplyCompletionMessageError": "При применении изменений произошла ошибка: {0}", "ApplyCompletionMessageError": "При применении изменений произошла ошибка: {0}",
"NavBack": "Назад", "NavBack": "Назад",
+1 -1
View File
@@ -163,7 +163,7 @@
Style="{DynamicResource ModalSecondaryStretchedButtonStyle}" Style="{DynamicResource ModalSecondaryStretchedButtonStyle}"
AutomationProperties.Name="%LANG:TitleBarSupportCreator%"> AutomationProperties.Name="%LANG:TitleBarSupportCreator%">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"> <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="&#xEB52;" FontFamily="{DynamicResource AppIconFontFamily}" FontSize="14" VerticalAlignment="Center" Margin="0,0,8,-1"/> <TextBlock x:Name="ApplyKofiIcon" Text="&#xEB52;" FontFamily="{DynamicResource AppIconFontFamily}" FontSize="14" VerticalAlignment="Center" Margin="0,0,8,-1"/>
<TextBlock Text="%LANG:TitleBarSupportCreator%" VerticalAlignment="Center" FontSize="14" Margin="0,0,0,1"/> <TextBlock Text="%LANG:TitleBarSupportCreator%" VerticalAlignment="Center" FontSize="14" Margin="0,0,0,1"/>
</StackPanel> </StackPanel>
</Button> </Button>
+3 -1
View File
@@ -367,7 +367,9 @@
</TextBlock.Style> </TextBlock.Style>
</TextBlock> </TextBlock>
<StackPanel Grid.Column="1" Orientation="Horizontal"> <StackPanel Grid.Column="1" Orientation="Horizontal">
<Button x:Name="KofiBtn" shell:WindowChrome.IsHitTestVisibleInChrome="True" Content="&#xEB52;" FontSize="15" Style="{StaticResource TitlebarButton}" ToolTip="%LANG:TitleBarSupportCreator%" AutomationProperties.Name="%LANG:TitleBarSupportCreator%"/> <Button x:Name="KofiBtn" shell:WindowChrome.IsHitTestVisibleInChrome="True" FontSize="15" Style="{StaticResource TitlebarButton}" ToolTip="%LANG:TitleBarSupportCreator%" AutomationProperties.Name="%LANG:TitleBarSupportCreator%">
<TextBlock x:Name="KofiIcon" Text="&#xEB52;" VerticalAlignment="Center"/>
</Button>
<Button x:Name="SettingsBtn" shell:WindowChrome.IsHitTestVisibleInChrome="True" Content="&#xE713;" FontSize="15" Style="{StaticResource TitlebarButton}" ToolTip="%LANG:SettingsTitle%" AutomationProperties.Name="%LANG:SettingsTitle%"/> <Button x:Name="SettingsBtn" shell:WindowChrome.IsHitTestVisibleInChrome="True" Content="&#xE713;" FontSize="15" Style="{StaticResource TitlebarButton}" ToolTip="%LANG:SettingsTitle%" AutomationProperties.Name="%LANG:SettingsTitle%"/>
<Button x:Name="MenuBtn" shell:WindowChrome.IsHitTestVisibleInChrome="True" Content="&#xE700;" FontSize="15" Style="{StaticResource TitlebarButton}" ToolTip="%LANG:TitleBarOptions%" AutomationProperties.Name="%LANG:TitleBarOptions%"> <Button x:Name="MenuBtn" shell:WindowChrome.IsHitTestVisibleInChrome="True" Content="&#xE700;" FontSize="15" Style="{StaticResource TitlebarButton}" ToolTip="%LANG:TitleBarOptions%" AutomationProperties.Name="%LANG:TitleBarOptions%">
<Button.ContextMenu> <Button.ContextMenu>
+3 -1
View File
@@ -501,7 +501,9 @@ function ConvertTo-LocalizedXaml {
if (-not $resolvesSomewhere) { $missingKeys.Add($key) } if (-not $resolvesSomewhere) { $missingKeys.Add($key) }
if ($DynamicResources) { return "{DynamicResource Language_$key}" } if ($DynamicResources) { return "{DynamicResource Language_$key}" }
$value = if ($resolvesSomewhere) { Get-Translation -Key $key -Lang $Lang } else { $key } $value = if ($resolvesSomewhere) { Get-Translation -Key $key -Lang $Lang } else { $key }
return [System.Security.SecurityElement]::Escape($value) # Literal line breaks in XML attributes are normalized to spaces by the reader.
# Character references preserve translated paragraphs in Text/ToolTip attributes.
return [System.Security.SecurityElement]::Escape($value).Replace("`r", '&#xD;').Replace("`n", '&#xA;')
} }
$result = [System.Text.RegularExpressions.Regex]::Replace($Xaml, '%LANG:([A-Za-z0-9_]+)%', $evaluator) $result = [System.Text.RegularExpressions.Regex]::Replace($Xaml, '%LANG:([A-Za-z0-9_]+)%', $evaluator)
+47
View File
@@ -21,6 +21,53 @@ function Update-WindowLanguageResources {
$text = Get-Translation -Key $key -Section 'Chrome' $text = Get-Translation -Key $key -Section 'Chrome'
foreach ($target in $targets) { $target.Resources["Language_$key"] = $text } 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)
}
} }
<# <#
+3 -2
View File
@@ -57,6 +57,7 @@ function Show-AboutDialog {
$versionText = $aboutWindow.FindName('VersionText') $versionText = $aboutWindow.FindName('VersionText')
$projectLink = $aboutWindow.FindName('ProjectLink') $projectLink = $aboutWindow.FindName('ProjectLink')
$kofiLink = $aboutWindow.FindName('KofiLink') $kofiLink = $aboutWindow.FindName('KofiLink')
Set-SupportLinkIcon -Icon $aboutWindow.FindName('KofiLinkIcon')
$closeButton = $aboutWindow.FindName('CloseButton') $closeButton = $aboutWindow.FindName('CloseButton')
# Set version # Set version
@@ -72,9 +73,9 @@ function Show-AboutDialog {
Start-Process "https://github.com/Raphire/Win11Debloat" Start-Process "https://github.com/Raphire/Win11Debloat"
}) })
# Ko-fi link click handler # Support link click handler
$kofiLink.Add_Click({ $kofiLink.Add_Click({
Start-Process "https://ko-fi.com/raphire" Start-Process (Get-SupportLinkUrl)
}) })
# Close button handler # Close button handler
+2 -1
View File
@@ -70,6 +70,7 @@ function Show-ApplyModal {
$applyRebootList = $applyWindow.FindName('ApplyRebootList') $applyRebootList = $applyWindow.FindName('ApplyRebootList')
$applyCloseBtn = $applyWindow.FindName('ApplyCloseBtn') $applyCloseBtn = $applyWindow.FindName('ApplyCloseBtn')
$applyKofiBtn = $applyWindow.FindName('ApplyKofiBtn') $applyKofiBtn = $applyWindow.FindName('ApplyKofiBtn')
Set-SupportLinkIcon -Icon $applyWindow.FindName('ApplyKofiIcon')
$applyCancelBtn = $applyWindow.FindName('ApplyCancelBtn') $applyCancelBtn = $applyWindow.FindName('ApplyCancelBtn')
# Initialize in-progress state # Initialize in-progress state
@@ -242,7 +243,7 @@ function Show-ApplyModal {
if ($script:ApplyModalInErrorState) { if ($script:ApplyModalInErrorState) {
Start-Process "https://github.com/Raphire/Win11Debloat/issues/new" Start-Process "https://github.com/Raphire/Win11Debloat/issues/new"
} else { } else {
Start-Process "https://ko-fi.com/raphire" Start-Process (Get-SupportLinkUrl)
} }
}) })
+1 -1
View File
@@ -85,7 +85,7 @@ function Show-MainWindow {
}) })
# ---- Menu/button event wiring ---- # ---- 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 }) $window.FindName('SettingsBtn').Add_Click({ Open-MainWindowSettings -Window $window })
$menuBtn.Add_Click({ $menuBtn.Add_Click({
+15
View File
@@ -329,6 +329,21 @@ Describe 'ConvertTo-LocalizedXaml' {
ConvertTo-LocalizedXaml -Xaml $xaml -Lang $script:EnLang | Should -Be '<a Text="Options"/><b Text="Close"/>' ConvertTo-LocalizedXaml -Xaml $xaml -Lang $script:EnLang | Should -Be '<a Text="Options"/><b Text="Close"/>'
} }
It 'preserves translated paragraphs through XML attribute parsing with <LineEnding> line breaks' -ForEach @(
@{ LineEnding = 'LF'; Separator = "`n" }
@{ LineEnding = 'CRLF'; Separator = "`r`n" }
) {
$text = "First & second.${Separator}${Separator}Support Ukraine."
$lang = [PSCustomObject]@{ Chrome = [PSCustomObject]@{ Message = $text } }
$xaml = ConvertTo-LocalizedXaml -Xaml '<TextBlock Text="%LANG:Message%"/>' -Lang $lang
$reader = [System.Xml.XmlReader]::Create([System.IO.StringReader]::new($xaml))
try {
[void]$reader.Read()
$reader.GetAttribute('Text') | Should -BeExactly $text
}
finally { $reader.Close() }
}
It 'throws when a marker key does not exist in any language' { It 'throws when a marker key does not exist in any language' {
$xaml = '<Button Content="%LANG:NoSuchKeyAnywhere%"/>' $xaml = '<Button Content="%LANG:NoSuchKeyAnywhere%"/>'