Skip to content

Commit 868ad03

Browse files
committed
Localize all CrashReportWindow strings via CoreTools.Translate
1 parent f624feb commit 868ad03

5 files changed

Lines changed: 42 additions & 24 deletions

File tree

src/UniGetUI.Avalonia/Views/DialogPages/CrashReportWindow.axaml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Window xmlns="https://github.com/avaloniaui"
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:t="using:UniGetUI.Avalonia.MarkupExtensions"
34
x:Class="UniGetUI.Avalonia.Views.DialogPages.CrashReportWindow"
4-
Title="UniGetUI – Crash Report"
5+
Title="{t:Translate UniGetUI – Crash Report}"
56
Width="800" MinWidth="500"
67
Height="580" MinHeight="380"
78
CanResize="True"
@@ -14,34 +15,34 @@
1415

1516
<!-- Title + description -->
1617
<StackPanel Spacing="4">
17-
<TextBlock Text="UniGetUI has crashed"
18+
<TextBlock Text="{t:Translate UniGetUI has crashed}"
1819
FontSize="22"
1920
FontWeight="SemiBold"/>
20-
<TextBlock Text="Help us fix this by sending a crash report to Devolutions. All fields below are optional."
21+
<TextBlock Text="{t:Translate Text='Help us fix this by sending a crash report to Devolutions. All fields below are optional.'}"
2122
Opacity="0.7"
2223
TextWrapping="Wrap"/>
2324
</StackPanel>
2425

2526
<!-- Email field -->
2627
<StackPanel Spacing="4">
27-
<TextBlock Text="Email (optional)" FontSize="12" Opacity="0.7"/>
28+
<TextBlock Text="{t:Translate Text='Email (optional)'}" FontSize="12" Opacity="0.7"/>
2829
<TextBox x:Name="EmailBox"
29-
Watermark="your@email.com"/>
30+
PlaceholderText="{t:Translate Text='your@email.com'}"/>
3031
</StackPanel>
3132

3233
<!-- Additional details field -->
3334
<StackPanel Spacing="4">
34-
<TextBlock Text="Additional details (optional)" FontSize="12" Opacity="0.7"/>
35+
<TextBlock Text="{t:Translate Text='Additional details (optional)'}" FontSize="12" Opacity="0.7"/>
3536
<TextBox x:Name="DetailsBox"
3637
AcceptsReturn="True"
3738
Height="90"
38-
Watermark="Describe what you were doing when the crash occurred…"
39+
PlaceholderText="{t:Translate Text='Describe what you were doing when the crash occurred…'}"
3940
TextWrapping="Wrap"/>
4041
</StackPanel>
4142

4243
<!-- Crash report (read-only) -->
4344
<StackPanel Spacing="4">
44-
<TextBlock Text="Crash report" FontSize="12" Opacity="0.7"/>
45+
<TextBlock Text="{t:Translate Text='Crash report'}" FontSize="12" Opacity="0.7"/>
4546
<TextBox x:Name="CrashReportText"
4647
AcceptsReturn="True"
4748
FontFamily="Cascadia Code,Cascadia Mono,Consolas,Menlo,monospace"
@@ -51,15 +52,13 @@
5152
TextWrapping="NoWrap"/>
5253
</StackPanel>
5354

54-
<!-- Action buttons -->
55+
<!-- Action buttons (content set in code-behind for translation) -->
5556
<StackPanel HorizontalAlignment="Right"
5657
Orientation="Horizontal"
5758
Spacing="8">
5859
<Button x:Name="DontSendButton"
59-
Content="Don't Send"
6060
Click="DontSend_Click"/>
6161
<Button x:Name="SendButton"
62-
Content="Send Report"
6362
Classes="accent"
6463
Click="SendReport_Click"/>
6564
</StackPanel>

src/UniGetUI.Avalonia/Views/DialogPages/CrashReportWindow.axaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ public CrashReportWindow(string crashReport)
1717
_crashReport = crashReport;
1818
InitializeComponent();
1919
CrashReportText.Text = crashReport;
20+
DontSendButton.Content = CoreTools.Translate("Don't Send");
21+
SendButton.Content = CoreTools.Translate("Send Report");
2022
}
2123

2224
private async void SendReport_Click(object? sender, RoutedEventArgs e)
2325
{
2426
SendButton.IsEnabled = false;
2527
DontSendButton.IsEnabled = false;
26-
SendButton.Content = "Sending…";
28+
SendButton.Content = CoreTools.Translate("Sending…");
2729

2830
string email = EmailBox.Text?.Trim() ?? string.Empty;
2931
string details = DetailsBox.Text?.Trim() ?? string.Empty;

src/UniGetUI.Core.LanguageEngine/Assets/Languages/lang_en.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,5 +1129,16 @@
11291129
"{pm} could not be found": "{pm} could not be found",
11301130
"{pm} found: {state}": "{pm} found: {state}",
11311131
"{pm} package manager specific preferences": "{pm} package manager specific preferences",
1132-
"{pm} preferences": "{pm} preferences"
1132+
"{pm} preferences": "{pm} preferences",
1133+
"Additional details (optional)": "Additional details (optional)",
1134+
"Crash report": "Crash report",
1135+
"Describe what you were doing when the crash occurred…": "Describe what you were doing when the crash occurred…",
1136+
"Don't Send": "Don't Send",
1137+
"Email (optional)": "Email (optional)",
1138+
"Help us fix this by sending a crash report to Devolutions. All fields below are optional.": "Help us fix this by sending a crash report to Devolutions. All fields below are optional.",
1139+
"Send Report": "Send Report",
1140+
"Sending…": "Sending…",
1141+
"UniGetUI – Crash Report": "UniGetUI – Crash Report",
1142+
"UniGetUI has crashed": "UniGetUI has crashed",
1143+
"your@email.com": "your@email.com"
11331144
}

src/UniGetUI/CrashReportWindow.xaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,21 @@
1717

1818
<!-- Title + description -->
1919
<StackPanel Spacing="4">
20-
<TextBlock Style="{StaticResource TitleTextBlockStyle}" Text="UniGetUI has crashed" />
20+
<TextBlock x:Name="TitleText" Style="{StaticResource TitleTextBlockStyle}" />
2121
<TextBlock
22+
x:Name="DescriptionText"
2223
Opacity="0.7"
2324
Style="{StaticResource BodyTextBlockStyle}"
24-
Text="Help us fix this by sending a crash report to Devolutions. All fields below are optional."
2525
TextWrapping="WrapWholeWords"
2626
/>
2727
</StackPanel>
2828

2929
<!-- Optional contact fields -->
30-
<TextBox x:Name="EmailBox" Header="Email (optional)" PlaceholderText="your@email.com" />
30+
<TextBox x:Name="EmailBox" />
3131
<TextBox
3232
x:Name="DetailsBox"
3333
AcceptsReturn="True"
34-
Header="Additional details (optional)"
3534
Height="100"
36-
PlaceholderText="Describe what you were doing when the crash occurred…"
3735
ScrollViewer.VerticalScrollBarVisibility="Auto"
3836
TextWrapping="Wrap"
3937
/>
@@ -44,25 +42,23 @@
4442
AcceptsReturn="True"
4543
FontFamily="Cascadia Code, Consolas"
4644
FontSize="11"
47-
Header="Crash report"
4845
Height="180"
4946
IsReadOnly="True"
5047
ScrollViewer.HorizontalScrollBarVisibility="Auto"
5148
ScrollViewer.VerticalScrollBarVisibility="Auto"
5249
TextWrapping="NoWrap"
5350
/>
5451

55-
<!-- Action buttons -->
52+
<!-- Action buttons (content set in code-behind for translation) -->
5653
<StackPanel
5754
HorizontalAlignment="Right"
5855
Orientation="Horizontal"
5956
Spacing="8"
6057
>
61-
<Button x:Name="DontSendButton" Click="DontSend_Click" Content="Don't Send" />
58+
<Button x:Name="DontSendButton" Click="DontSend_Click" />
6259
<Button
6360
x:Name="SendButton"
6461
Click="SendReport_Click"
65-
Content="Send Report"
6662
Style="{StaticResource AccentButtonStyle}"
6763
/>
6864
</StackPanel>

src/UniGetUI/CrashReportWindow.xaml.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
using System.Text.Json.Nodes;
44
using Microsoft.UI.Windowing;
55
using Microsoft.UI.Xaml;
6-
using Windows.Graphics;
76
using UniGetUI.Core.Data;
87
using UniGetUI.Core.Tools;
8+
using Windows.Graphics;
99

1010
namespace UniGetUI;
1111

@@ -31,14 +31,24 @@ public CrashReportWindow(string crashReport)
3131
));
3232
}
3333

34+
Title = CoreTools.Translate("UniGetUI – Crash Report");
35+
TitleText.Text = CoreTools.Translate("UniGetUI has crashed");
36+
DescriptionText.Text = CoreTools.Translate("Help us fix this by sending a crash report to Devolutions. All fields below are optional.");
37+
EmailBox.Header = CoreTools.Translate("Email (optional)");
38+
EmailBox.PlaceholderText = CoreTools.Translate("your@email.com");
39+
DetailsBox.Header = CoreTools.Translate("Additional details (optional)");
40+
DetailsBox.PlaceholderText = CoreTools.Translate("Describe what you were doing when the crash occurred…");
41+
CrashReportText.Header = CoreTools.Translate("Crash report");
3442
CrashReportText.Text = crashReport;
43+
DontSendButton.Content = CoreTools.Translate("Don't Send");
44+
SendButton.Content = CoreTools.Translate("Send Report");
3545
}
3646

3747
private async void SendReport_Click(object sender, RoutedEventArgs e)
3848
{
3949
SendButton.IsEnabled = false;
4050
DontSendButton.IsEnabled = false;
41-
SendButton.Content = "Sending…";
51+
SendButton.Content = CoreTools.Translate("Sending…");
4252

4353
string email = EmailBox.Text.Trim();
4454
string details = DetailsBox.Text.Trim();

0 commit comments

Comments
 (0)