Skip to content

Commit

Permalink
Add tranlation strings for error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangiebel committed Jan 22, 2025
1 parent 0340061 commit 155eb46
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 12 deletions.
15 changes: 15 additions & 0 deletions SS14.Launcher/Assets/Locale/en-US/text.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,21 @@ tab-options-disable-signing-desc = { "[" }DEV ONLY] Disables verification of eng
tab-options-hub-settings = Hub Settings
tab-options-hub-settings-desc = Change what hub server or servers you would like to use to fetch the server list.
tab-options-desc-incompatible = This option is incompatible with your platform and has been disabled.
tab-options-sentry = Error Reporting
tab-options-sentry-desc = Automatically report errors. (requires launcher restart)
## Strings for error reporting
sentry-permission-dialog-title = Error Reporting
sentry-permission-dialog-content = Allow errors to automatically be uploaded?
sentry-permission-dialog-confirm = Allow
sentry-permission-dialog-cancel = Deny
sentry-error-dialog-title = Launcher Error
sentry-error-dialog-message = An error occured and an anonymous report will automatically be sent.
sentry-error-dialog-feedback-label = Feedback
sentry-error-dialog-feedback-placeholder = Write what happened...
sentry-error-dialog-send-button = Send
sentry-error-dialog-validation-max-length-error = Feedback can't be longer than { $maxFeedbackLength } characters
## For the language selection menu.

Expand Down
8 changes: 4 additions & 4 deletions SS14.Launcher/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,10 @@ private async Task InquireSentryPermission()

var dialog = new ConfirmDialog
{
Title = "Error Reporting",
DialogContent = "Allow errors to automatically be uploaded?",
ConfirmButtonText = "Allow",
CancelButtonText = "Deny"
Title = LocalizationManager.Instance.GetString("sentry-permission-dialog-title"),
DialogContent = LocalizationManager.Instance.GetString("sentry-permission-dialog-content"),
ConfirmButtonText = LocalizationManager.Instance.GetString("sentry-permission-dialog-confirm"),
CancelButtonText = LocalizationManager.Instance.GetString("sentry-permission-dialog-cancel"),
};

var result = await dialog.ShowDialog<bool>(Control!);
Expand Down
4 changes: 2 additions & 2 deletions SS14.Launcher/Views/MainWindowTabs/OptionsTabView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
Text="{loc:Loc tab-options-verbose-launcher-logging-desc}"
Margin="8" />

<CheckBox VerticalAlignment="Center" Margin="4" IsChecked="{Binding EnableSentry}">Error Reporting</CheckBox>
<CheckBox VerticalAlignment="Center" Margin="4" IsChecked="{Binding EnableSentry}" Content="{loc:Loc tab-options-sentry}"></CheckBox>
<TextBlock VerticalAlignment="Center" TextWrapping="Wrap"
Text="Automatically report errors. (requires launcher restart)"
Text="{loc:Loc tab-options-sentry-desc}"
Margin="8" />

<CheckBox VerticalAlignment="Center" Margin="4" IsChecked="{Binding OverrideAssets}" Content="{loc:Loc tab-options-seasonal-branding}" />
Expand Down
11 changes: 6 additions & 5 deletions SS14.Launcher/Views/SentryFeedbackWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:loc="clr-namespace:SS14.Launcher.Localization"
mc:Ignorable="d" d:DesignWidth="300" d:DesignHeight="100"
MinWidth="550" MinHeight="300"
Width="550" Height="300"
x:Class="SS14.Launcher.Views.SentryFeedbackWindow"
Icon="{DynamicResource WindowIcon}"
Title="Launcher Error"
Title="{loc:Loc sentry-error-dialog-title }"
Padding="8"
WindowStartupLocation="CenterOwner">

Expand All @@ -34,18 +35,18 @@
</DrawingImage>
</Image>
<TextBlock Width="350" TextWrapping="Wrap" Name="Content" HorizontalAlignment="Left" DockPanel.Dock="Top"
Text="An error occured and an anonymous report will automatically be sent."/>
Text="{loc:Loc sentry-error-dialog-message }"/>
</StackPanel>

<TextBlock DockPanel.Dock="Top" Text="Feedback" Classes="NanoHeadingSmall"/>
<TextBox Name="FeedbackField" Margin="4" DockPanel.Dock="Top" Watermark="Write what happened..."
<TextBlock DockPanel.Dock="Top" Text="{loc:Loc sentry-error-dialog-feedback-label }" Classes="NanoHeadingSmall"/>
<TextBox Name="FeedbackField" Margin="4" DockPanel.Dock="Top" Watermark="{loc:Loc sentry-error-dialog-feedback-placeholder }"
NewLine="&#x0a;" AcceptsReturn="True" HorizontalAlignment="Stretch" Height="180"
PropertyChanged="FeedbackTextChanged"/>

<TextBlock DockPanel.Dock="Top" Name="ValidationText" Classes="SubText"/>

<StackPanel Orientation="Horizontal" FlowDirection="RightToLeft" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" DockPanel.Dock="Bottom" Height="42">
<Button HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="4 0" Name="SendButton" Content="Send" />
<Button HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="4 0" Name="SendButton" Content="{loc:Loc sentry-error-dialog-send-button }" />
</StackPanel>
</DockPanel>
</Window>
3 changes: 2 additions & 1 deletion SS14.Launcher/Views/SentryFeedbackWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Avalonia.Controls;
using Avalonia.Input;
using ReactiveUI;
using SS14.Launcher.Localization;

namespace SS14.Launcher.Views;

Expand Down Expand Up @@ -63,7 +64,7 @@ private void FeedbackTextChanged(object? sender, AvaloniaPropertyChangedEventArg
}

FeedbackField.Text = text[..MaxFeedbackLength];
ValidationText.Text = $"Feedback can't be longer than {MaxFeedbackLength} characters";
ValidationText.Text = LocalizationManager.Instance.GetString("sentry-error-dialog-validation-max-length-error", ("maxFeedbackLength", MaxFeedbackLength));
FeedbackField.Classes.Add("Invalid");
}
}

0 comments on commit 155eb46

Please sign in to comment.