Browse Source

Localize more of UpdateDialog

pull/165/head
Ionite 1 year ago
parent
commit
1af0106161
No known key found for this signature in database
  1. 36
      StabilityMatrix.Avalonia/Languages/Resources.Designer.cs
  2. 12
      StabilityMatrix.Avalonia/Languages/Resources.resx
  3. 24
      StabilityMatrix.Avalonia/ViewModels/Dialogs/UpdateViewModel.cs
  4. 34
      StabilityMatrix.Avalonia/Views/Dialogs/UpdateDialog.axaml

36
StabilityMatrix.Avalonia/Languages/Resources.Designer.cs generated

@ -185,6 +185,15 @@ namespace StabilityMatrix.Avalonia.Languages {
}
}
/// <summary>
/// Looks up a localized string similar to Install Now.
/// </summary>
public static string Action_InstallNow {
get {
return ResourceManager.GetString("Action_InstallNow", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Launch.
/// </summary>
@ -284,6 +293,15 @@ namespace StabilityMatrix.Avalonia.Languages {
}
}
/// <summary>
/// Looks up a localized string similar to Remind Me Later.
/// </summary>
public static string Action_RemindMeLater {
get {
return ResourceManager.GetString("Action_RemindMeLater", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Remove.
/// </summary>
@ -1238,6 +1256,15 @@ namespace StabilityMatrix.Avalonia.Languages {
}
}
/// <summary>
/// Looks up a localized string similar to Release Notes.
/// </summary>
public static string Label_ReleaseNotes {
get {
return ResourceManager.GetString("Label_ReleaseNotes", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Releases.
/// </summary>
@ -1598,6 +1625,15 @@ namespace StabilityMatrix.Avalonia.Languages {
}
}
/// <summary>
/// Looks up a localized string similar to The app will relaunch after updating.
/// </summary>
public static string Text_AppWillRelaunchAfterUpdate {
get {
return ResourceManager.GetString("Text_AppWillRelaunchAfterUpdate", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Choose your preferred interface and click Install to get started.
/// </summary>

12
StabilityMatrix.Avalonia/Languages/Resources.resx

@ -657,4 +657,16 @@
<data name="Label_CurrentDirectory" xml:space="preserve">
<value>Current directory:</value>
</data>
<data name="Text_AppWillRelaunchAfterUpdate" xml:space="preserve">
<value>The app will relaunch after updating</value>
</data>
<data name="Action_RemindMeLater" xml:space="preserve">
<value>Remind Me Later</value>
</data>
<data name="Action_InstallNow" xml:space="preserve">
<value>Install Now</value>
</data>
<data name="Label_ReleaseNotes" xml:space="preserve">
<value>Release Notes</value>
</data>
</root>

24
StabilityMatrix.Avalonia/ViewModels/Dialogs/UpdateViewModel.cs

@ -8,6 +8,7 @@ using AsyncAwaitBestPractices;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Semver;
using StabilityMatrix.Avalonia.Languages;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Avalonia.Views.Dialogs;
using StabilityMatrix.Core.Attributes;
@ -46,6 +47,12 @@ public partial class UpdateViewModel : ContentDialogViewModelBase
[ObservableProperty]
private bool showProgressBar;
[ObservableProperty]
private string? currentVersionText;
[ObservableProperty]
private string? newVersionText;
public UpdateViewModel(
ISettingsManager settingsManager,
IHttpClientFactory httpClientFactory,
@ -102,14 +109,14 @@ public partial class UpdateViewModel : ContentDialogViewModelBase
}
}
public override async Task OnLoadedAsync()
partial void OnUpdateInfoChanged(UpdateInfo? value)
{
if (UpdateInfo is null)
return;
UpdateText =
$"Stability Matrix v{UpdateInfo.Version} is now available! You currently have v{Compat.AppVersion}. Would you like to update now?";
CurrentVersionText = $"v{Compat.AppVersion}";
NewVersionText = $"v{value?.Version}";
}
public override async Task OnLoadedAsync()
{
if (!isLoaded)
{
await Preload();
@ -132,7 +139,10 @@ public partial class UpdateViewModel : ContentDialogViewModelBase
}
ShowProgressBar = true;
UpdateText = $"Downloading update v{UpdateInfo.Version}...";
UpdateText = string.Format(
Resources.TextTemplate_UpdatingPackage,
Resources.Label_StabilityMatrix
);
await updateHelper.DownloadUpdate(
UpdateInfo,
new Progress<ProgressReport>(report =>

34
StabilityMatrix.Avalonia/Views/Dialogs/UpdateDialog.axaml

@ -8,6 +8,7 @@
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls"
xmlns:mdxaml="https://github.com/whistyun/Markdown.Avalonia.Tight"
xmlns:lang="clr-namespace:StabilityMatrix.Avalonia.Languages"
xmlns:fluentIcons="clr-namespace:FluentIcons.FluentAvalonia;assembly=FluentIcons.FluentAvalonia"
d:DataContext="{x:Static mocks:DesignData.UpdateViewModel}"
x:DataType="dialogs:UpdateViewModel"
mc:Ignorable="d" d:DesignWidth="700" d:DesignHeight="550"
@ -27,16 +28,37 @@
Margin="0,16,0,0"
FontSize="28"/>
<StackPanel Grid.Row="1"
Margin="0,4"
Orientation="Horizontal"
IsVisible="{Binding UpdateText, Converter={x:Static StringConverters.IsNullOrEmpty}}"
HorizontalAlignment="Center">
<TextBlock
Foreground="{StaticResource ThemeGreyColor}"
FontSize="18"
Text="{Binding CurrentVersionText}"/>
<fluentIcons:SymbolIcon
FontSize="15"
Margin="8,0"
VerticalAlignment="Center"
Symbol="ArrowRight"
IsFilled="True"/>
<TextBlock
FontSize="18"
Text="{Binding NewVersionText}"/>
</StackPanel>
<TextBlock Grid.Row="1"
HorizontalAlignment="Center"
FontSize="18"
TextWrapping="Wrap"
TextAlignment="Center"
IsVisible="{Binding UpdateText, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
Text="{Binding UpdateText}"
Margin="16,32,16,0"/>
<TextBlock Grid.Row="2"
Text="Release Notes"
Text="{x:Static lang:Resources.Label_ReleaseNotes}"
FontSize="16"
IsVisible="{Binding !ShowProgressBar}"
Margin="32,16,32,0"/>
@ -63,20 +85,20 @@
Margin="64,0,64,16"
IsOpen="True"
IsClosable="False"
Title="The app will relaunch after updating" />
Title="{x:Static lang:Resources.Text_AppWillRelaunchAfterUpdate}" />
<StackPanel Grid.Row="6" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,0,0,16">
<Button Content="Remind Me Later"
<Button Content="{x:Static lang:Resources.Action_RemindMeLater}"
Classes="info"
Margin="0,0,8,0"
FontSize="18"
FontSize="15"
Command="{Binding OnCloseButtonClick}"
IsEnabled="{Binding !InstallUpdateCommand.IsRunning}" />
<Button Content="Install Now"
<Button Content="{x:Static lang:Resources.Action_InstallNow}"
Classes="success"
Margin="8,0,0,0"
FontSize="18"
FontSize="15"
Command="{Binding InstallUpdateCommand}" />
</StackPanel>

Loading…
Cancel
Save