Skip to content

Commit

Permalink
Add Russian, and Japanese language support
Browse files Browse the repository at this point in the history
  • Loading branch information
CarbonNeuron committed Jan 31, 2021
1 parent ea14d5a commit 5c93e52
Show file tree
Hide file tree
Showing 11 changed files with 412 additions and 30 deletions.
7 changes: 3 additions & 4 deletions AUCapture-WPF/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
mah:TextBoxHelper.ButtonCommand="{Binding TextBoxButtonHelpCmd, Mode=OneWay}"
mah:TextBoxHelper.ButtonsAlignment="Right"
mah:TextBoxHelper.SelectAllOnFocus="True"
mah:TextBoxHelper.Watermark="{l:Static properties:Resources.SettingsDiscordTabHeader}"
mah:TextBoxHelper.Watermark="{l:Static properties:Resources.SettingsDiscordTabTokenWatermark}"
Style="{DynamicResource MahApps.Styles.PasswordBox.Button}">
<mah:TextBoxHelper.ButtonContent>
<Path
Expand All @@ -285,7 +285,7 @@
Margin="5,0,5,0"
HorizontalAlignment="Center"
Click="SubmitDiscordButton_OnClick"
Content="{l:Static properties:Resources.SettingsDiscordTabHeader}"
Content="{l:Static properties:Resources.SettingsDiscordTabSubmitButton}"
IsDefault="True"
Style="{DynamicResource MahApps.Styles.Button.Dialogs.Accent}" />
</StackPanel>
Expand All @@ -297,7 +297,7 @@
<mah:MetroHeader Header="{l:Static properties:Resources.SettingsAboutTabAutoUpdaterHeader}">
<CheckBox IsChecked="{Binding AutoUpdaterEnabled, Mode=OneWay}" IsEnabled="False" />
</mah:MetroHeader>
<mah:MetroHeader Header="{l:Static properties:Resources.SettingsAboutTabAutoUpdaterHeader}">
<mah:MetroHeader Header="{l:Static properties:Resources.SettingsAboutTabAppVersion}">
<TextBox
MinWidth="150"
VerticalAlignment="Center"
Expand Down Expand Up @@ -384,7 +384,6 @@
<TextBox
x:Name="Code"
MinWidth="150"
VerticalAlignment="Center"
Text="{Binding Settings.connectCode, Mode=TwoWay}" />
</StackPanel>
<Button
Expand Down
35 changes: 12 additions & 23 deletions AUCapture-WPF/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
Expand All @@ -33,6 +34,7 @@
using System.Windows.Media.Imaging;
using System.Windows.Threading;
using AUCapture_WPF.Models;
using AUCapture_WPF.Properties;
using Discord;
using Gu.Localization;
using HandyControl.Tools;
Expand Down Expand Up @@ -140,8 +142,8 @@ public MainWindow() {
if(context.Settings.language == "") {
var cultures = Translator.Cultures;
var ci = CultureInfo.CurrentUICulture;
if(cultures.Any(x=>x.Name == ci.Name)) {
Translator.Culture = CultureInfo.GetCultureInfo(ci.Name);
if(cultures.Any(x=>x.TwoLetterISOLanguageName == ci.TwoLetterISOLanguageName)) {
Translator.Culture = CultureInfo.GetCultureInfo(CultureInfo.CurrentUICulture.TwoLetterISOLanguageName);
}
}
else {
Expand Down Expand Up @@ -241,14 +243,14 @@ public async void ShowErrorBox(string errorMessage, string title = "ERROR") {
var errorBox = await context.DialogCoordinator.ShowMessageAsync(context, title,
errorMessage, MessageDialogStyle.AffirmativeAndNegative,
new MetroDialogSettings {
AffirmativeButtonText = "retry",
NegativeButtonText = "cancel",
AffirmativeButtonText = Translate.Key("RetryText"),
NegativeButtonText = Translate.Key("CancelText"),
DefaultButtonFocus = MessageDialogResult.Affirmative,
AnimateShow = false
});
if (errorBox == MessageDialogResult.Affirmative) await Task.Factory.StartNew(Update, TaskCreationOptions.LongRunning);
}

public async void Update() {
var version = new Version();
var latestVersion = new Version();
Expand Down Expand Up @@ -283,29 +285,16 @@ public async void Update() {
{
if (Assembly.GetExecutingAssembly().GetManifestResourceNames().All(x => x != "AUCapture_WPF.Resources.AutoMuteUs_PK.asc"))
{
ShowErrorBox($"We detected an update to {latestVersion}, But there is no public key in this capture so we will not be able to verify integrity. Please download the latest release off the github page.","AutoUpdater failed");
ShowErrorBox(String.Format(Translate.Key("PrivateKeyErrorMessage"), latestVersion.ToString(3)),Translate.Key("PrivateKeyErrorMessage"));
return;
}
var selection = await context.DialogCoordinator.ShowMessageAsync(context, "Caution",
$"We've detected you're using an older version of AmongUsCapture!\nYour version: {version}\nLatest version: {latestVersion}",
var selection = await context.DialogCoordinator.ShowMessageAsync(context, Translate.Key("UpdateNotificationHeader"),
String.Format(Translate.Key("UpdateNotificationMessage"), version.ToString(3), latestVersion.ToString(3)),
MessageDialogStyle.AffirmativeAndNegative, new MetroDialogSettings
{
AffirmativeButtonText =
"Update",
NegativeButtonText = "No thanks", DefaultButtonFocus = MessageDialogResult.Affirmative
AffirmativeButtonText = Translate.Key("UpdateNotificationUpdate"),
NegativeButtonText = Translate.Key("UpdateNotificationDecline"), DefaultButtonFocus = MessageDialogResult.Affirmative
});
if (selection == MessageDialogResult.Negative)
{
selection = await context.DialogCoordinator.ShowMessageAsync(context, "Warning",
$"Having an older version could cause compatibility issues with AutoMuteUs.\nWe can automagically update you to {latestVersion}.",
MessageDialogStyle.AffirmativeAndNegative, new MetroDialogSettings
{
AffirmativeButtonText =
"Update",
NegativeButtonText = "no ty", DefaultButtonFocus = MessageDialogResult.Affirmative
});
}

if (selection == MessageDialogResult.Affirmative)
{
var DownloadProgress =
Expand Down
72 changes: 72 additions & 0 deletions AUCapture-WPF/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions AUCapture-WPF/Properties/Resources.en.resx
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,27 @@
<data name="OffText" xml:space="preserve">
<value>Off</value>
</data>
<data name="PrivateKeyErrorMessage" xml:space="preserve">
<value>We detected an update to {0}, But there is no public key in this capture so we will not be able to verify integrity. Please download the latest release off the github page.</value>
</data>
<data name="PrivateKeyErrorTitle" xml:space="preserve">
<value>AutoUpdater failed</value>
</data>
<data name="CancelText" xml:space="preserve">
<value>cancel</value>
</data>
<data name="UpdateNotificationMessage" xml:space="preserve">
<value>We've detected you're using an older version of AmongUsCapture!
Your version: {0}
Latest version: {1}</value>
</data>
<data name="UpdateNotificationHeader" xml:space="preserve">
<value>Caution</value>
</data>
<data name="UpdateNotificationDecline" xml:space="preserve">
<value>No thanks</value>
</data>
<data name="UpdateNotificationUpdate" xml:space="preserve">
<value>Update</value>
</data>
</root>
Loading

0 comments on commit 5c93e52

Please sign in to comment.