Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit dc02d6d

Browse files
committed
added update window translations
1 parent 70396cc commit dc02d6d

File tree

4 files changed

+26
-11
lines changed

4 files changed

+26
-11
lines changed

Interop/TranslationProvider.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,15 @@ private void FillToEnglishDefaults()
318318
language.Add("DuplicateConfigNames", "You cannot have 2 configs or more with the same name.");
319319
language.Add("EmptyConfigNames", "You cannot have configs with an empty name.");
320320
language.Add("DefaultValues", "Default values");
321+
language.Add("WantToUpdate", "Do you want to update?");
322+
language.Add("VersionAvailable", "Version {0} is available for download!");
323+
language.Add("Yes", "Yes");
324+
language.Add("No", "No");
325+
language.Add("ViewGithub", "View on GitHub");
326+
language.Add("UpdatingTo", "Updating to {0}");
327+
language.Add("DownloadingUpdater", "Downloading updater...");
328+
language.Add("StartingUpdater", "Starting updater...");
329+
321330
}
322331
}
323332
}

Interop/Updater/UpdateWindow.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
<Grid>
1818
<Image Name="Icon" Source="/SPCode;component/Resources/Icon.ico" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5,5,5,5" Width="40" Height="40"/>
1919
<mahapps:ProgressRing Name="Progress" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5,5,5,5" Width="40" Height="40" IsActive="False" IsLarge="False" IsHitTestVisible="False" />
20-
<TextBlock Name="MainLine" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="50,0,0,0" FontSize="16" Foreground="{StaticResource AccentColorBrush}" Text="Update now?" IsHitTestVisible="False" />
20+
<TextBlock Name="MainLine" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="50,0,0,0" FontSize="16" Foreground="{StaticResource AccentColorBrush}" IsHitTestVisible="False" />
2121
<TextBlock Name="SubLine" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="50,25,0,0" FontSize="14" IsHitTestVisible="False" />
22-
<Button Name="ActionYesButton" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="50,25,0,0" Content="Yes" Width="50" Click="ActionYesButton_Click" />
23-
<Button Name="ActionNoButton" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="110,25,0,0" Content="No" Width="50" Click="ActionNoButton_Click" />
22+
<Button Name="ActionYesButton" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="50,25,0,0" Width="50" Click="ActionYesButton_Click" />
23+
<Button Name="ActionNoButton" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="110,25,0,0" Width="50" Click="ActionNoButton_Click" />
2424
<RichTextBox Name="DescriptionBox" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,55,0,0" VerticalScrollBarVisibility="Visible" IsReadOnly="True" />
25-
<Button x:Name="ActionGithubButton" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="170,25,0,0" Content="View on Github" Width="110" Click="ActionGithubButton_Click" />
25+
<Button x:Name="ActionGithubButton" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="170,25,0,0" Width="110" Click="ActionGithubButton_Click" />
2626
</Grid>
2727
</mahapps:MetroWindow>

Interop/Updater/UpdateWindow.xaml.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,14 @@ public UpdateWindow(UpdateInfo info) : this()
2929
{
3030
updateInfo = info;
3131

32-
Title = $"Version {info.Release.TagName} is available for download!";
32+
Title = string.Format(Program.Translations.GetLanguage("VersionAvailable"), info.Release.TagName);
33+
MainLine.Text = Program.Translations.GetLanguage("WantToUpdate");
34+
ActionYesButton.Content = Program.Translations.GetLanguage("Yes");
35+
ActionNoButton.Content = Program.Translations.GetLanguage("No");
36+
ActionGithubButton.Content = Program.Translations.GetLanguage("ViewGithub");
3337
DescriptionBox.AppendText(Markdown.ToPlainText(updateInfo.Release.Body));
3438

39+
3540
if (info.SkipDialog)
3641
{
3742
StartUpdate();
@@ -58,10 +63,11 @@ private void StartUpdate()
5863

5964
ActionYesButton.Visibility = Visibility.Hidden;
6065
ActionNoButton.Visibility = Visibility.Hidden;
66+
ActionGithubButton.Visibility = Visibility.Hidden;
6167
Icon.Visibility = Visibility.Hidden;
6268
Progress.IsActive = true;
63-
MainLine.Text = "Updating to " + updateInfo.Release.TagName;
64-
SubLine.Text = "Downloading updater...";
69+
MainLine.Text = string.Format(Program.Translations.GetLanguage("UpdatingTo"), updateInfo.Release.TagName);
70+
SubLine.Text = Program.Translations.GetLanguage("DownloadingUpdater");
6571
var t = new Thread(UpdateDownloadWorker);
6672
t.Start();
6773
}
@@ -93,13 +99,13 @@ private void UpdateDownloadWorker()
9399
Dispatcher.Invoke(Close);
94100
}
95101

96-
Thread.Sleep(100); //safety reasons
102+
Thread.Sleep(100);
97103
Dispatcher.Invoke(FinalizeUpdate);
98104
}
99105

100106
private void FinalizeUpdate()
101107
{
102-
SubLine.Text = "Starting Updater";
108+
SubLine.Text = Program.Translations.GetLanguage("StartingUpdater");
103109
UpdateLayout();
104110
try
105111
{
@@ -117,7 +123,7 @@ private void FinalizeUpdate()
117123

118124
Close();
119125
}
120-
126+
121127
private void ActionGithubButton_Click(object sender, RoutedEventArgs e)
122128
{
123129
Process.Start(new ProcessStartInfo(Constants.GitHubLatestRelease));

Spcode.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
</Reference>
141141
</ItemGroup>
142142
<ItemGroup>
143-
<Compile Include="App\AssemblyInfo1.cs" />
143+
<Compile Include="App\AssemblyInfo.cs" />
144144
<Compile Include="Interop\ConfigControl.cs" />
145145
<Compile Include="Interop\PipeInteropClient.cs" />
146146
<Compile Include="Interop\PipeInteropServer.cs" />

0 commit comments

Comments
 (0)