From 6c0b142106ce6260583b349493f2766a2901dc58 Mon Sep 17 00:00:00 2001 From: oZ-Zo <50652175+oz-zo@users.noreply.github.com> Date: Wed, 26 Feb 2020 17:45:13 +0300 Subject: [PATCH] New feature: switching from Russian to English :sparkles: --- W10SS_GUI/Classes/AppCulture.cs | 37 ++++++++++ W10SS_GUI/Localized/RU.xaml | 23 ++++++- W10SS_GUI/MainWindow.xaml | 116 +++++++++++++++----------------- W10SS_GUI/MainWindow.xaml.cs | 58 ++++++++++++---- W10SS_GUI/Model/ModelGui.cs | 14 ++++ W10SS_GUI/Resource/tags.xaml | 3 +- W10SS_GUI/W10SS_GUI.csproj | 2 + Win10SetupScript.zip | Bin 0 -> 19177 bytes 8 files changed, 173 insertions(+), 80 deletions(-) create mode 100644 W10SS_GUI/Classes/AppCulture.cs create mode 100644 W10SS_GUI/Model/ModelGui.cs create mode 100644 Win10SetupScript.zip diff --git a/W10SS_GUI/Classes/AppCulture.cs b/W10SS_GUI/Classes/AppCulture.cs new file mode 100644 index 00000000..95ce2f81 --- /dev/null +++ b/W10SS_GUI/Classes/AppCulture.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; + +namespace W10SS_GUI +{ + internal class AppCulture + { + private class Culture + { + internal const string EN = "en"; + internal const string RU = "ru"; + } + + private string _culture = Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName == Culture.RU ? Culture.RU : Culture.EN; + private ResourceDictionary resourceDictionaryEn = new ResourceDictionary() { Source = new Uri("pack://application:,,,/Localized/EN.xaml", UriKind.Absolute) }; + private ResourceDictionary resourceDictionaryRu = new ResourceDictionary() { Source = new Uri("pack://application:,,,/Localized/RU.xaml", UriKind.Absolute) }; + internal ResourceDictionary CurrentCulture + { + get + { + return _culture == Culture.RU ? resourceDictionaryRu : resourceDictionaryEn; + } + } + + internal ResourceDictionary ChangeCulture() + { + if (_culture == Culture.RU) _culture = Culture.EN; + else _culture = Culture.RU; + return _culture == Culture.RU ? resourceDictionaryRu : resourceDictionaryEn; + } + } +} diff --git a/W10SS_GUI/Localized/RU.xaml b/W10SS_GUI/Localized/RU.xaml index e75dcdce..7f26e344 100644 --- a/W10SS_GUI/Localized/RU.xaml +++ b/W10SS_GUI/Localized/RU.xaml @@ -1,5 +1,24 @@  - + xmlns:local="clr-namespace:W10SS_GUI.Localized" + xmlns:system="clr-namespace:System;assembly=mscorlib"> + Windows 10 Setup Script + + Телеметрия + Персонализация + OneDrive + Система + Меню "Пуск" + UWP Приложения + Игровой режим + Планировщик + Microsoft Defender + Контекстное меню + + Применить + Сохранить + Импортировать + English + GitHub + \ No newline at end of file diff --git a/W10SS_GUI/MainWindow.xaml b/W10SS_GUI/MainWindow.xaml index b2ad3699..e38fdbdf 100644 --- a/W10SS_GUI/MainWindow.xaml +++ b/W10SS_GUI/MainWindow.xaml @@ -19,9 +19,7 @@ ResizeMode="CanResize" ShowInTaskbar="True" Background="{DynamicResource colorWindowBackground}" - Foreground="{DynamicResource colorWindowForeground}" - Initialized="Window_Initialized" - Icon="windows10.ico" + Foreground="{DynamicResource colorWindowForeground}" SizeToContent="Manual">