Skip to content

Portable Tool for an Ideal Windows Setup

correction locale & add language selection based on the code and region deb v 5.2.7

Greedeksf3a1b21562ad
diff --git a/.Source/GTweak/App.xaml.cs b/.Source/GTweak/App.xaml.cs
index d2832db7..d7573628 100644
--- a/.Source/GTweak/App.xaml.cs
+++ b/.Source/GTweak/App.xaml.cs
@@ -54,22 +54,33 @@ namespace GTweak
Environment.Exit(0);
}
+
+ private static Uri GetResourceUri(string folder, bool isTheme = false) => isTheme ? new Uri($"Styles/Themes/{folder}/Colors.xaml", UriKind.Relative) : new Uri($"Languages/{folder}/Localize.xaml", UriKind.Relative);
+
internal static string Language
{
set
{
- value ??= SystemDiagnostics.SystemDefaultLanguage;
+ var (code, region) = SystemDiagnostics.GetCurrentSystemLang();
+
+ value ??= code;
+
+ if (value.Contains('-'))
+ {
+ code = value.Split('-')[0];
+ region = value.Split('-').Length > 1 ? value.Split('-')[1] : string.Empty;
+ }
ResourceDictionary dictionary = new ResourceDictionary
{
- Source = (value == "be" ? "ru" : value) switch
+ Source = value switch
{
- "fr" => new Uri("Languages/fr/Localize.xaml", UriKind.Relative),
- "it" => new Uri("Languages/it/Localize.xaml", UriKind.Relative),
- "ko" => new Uri("Languages/ko/Localize.xaml", UriKind.Relative),
- "ru" => new Uri("Languages/ru/Localize.xaml", UriKind.Relative),
- "uk" => new Uri("Languages/uk/Localize.xaml", UriKind.Relative),
- _ => new Uri("Languages/en/Localize.xaml", UriKind.Relative),
+ "fr" => GetResourceUri("fr"),
+ "it" => GetResourceUri("it"),
+ "ko" => GetResourceUri("ko"),
+ _ when new[] { "ru", "be" }.Contains(value) => GetResourceUri("ru"),
+ "uk" => GetResourceUri("uk"),
+ _ => GetResourceUri("en")
}
};
@@ -98,12 +109,12 @@ namespace GTweak
{
Source = value switch
{
- "Dark" => new Uri($"Styles/Themes/Dark/Colors.xaml", UriKind.Relative),
- "Light" => new Uri($"Styles/Themes/Light/Colors.xaml", UriKind.Relative),
- "Cobalt" => new Uri($"Styles/Themes/Cobalt/Colors.xaml", UriKind.Relative),
- "Dark amethyst" => new Uri($"Styles/Themes/Dark amethyst/Colors.xaml", UriKind.Relative),
- "Cold Blue" => new Uri($"Styles/Themes/Cold blue/Colors.xaml", UriKind.Relative),
- _ => RegistryHelp.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", string.Empty) == "0" ? new Uri("Styles/Themes/Dark/Colors.xaml", UriKind.Relative) : new Uri($"Styles/Themes/Light/Colors.xaml", UriKind.Relative),
+ "Dark" => GetResourceUri("Dark", true),
+ "Light" => GetResourceUri("Light", true),
+ "Cobalt" => GetResourceUri("Cobalt", true),
+ "Dark amethyst" => GetResourceUri("Dark amethyst", true),
+ "Cold Blue" => GetResourceUri("Cold Blue", true),
+ _ => RegistryHelp.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", string.Empty) == "0" ? GetResourceUri("Dark", true) : GetResourceUri("Light", true)
}
};
diff --git a/.Source/GTweak/GTweak.csproj b/.Source/GTweak/GTweak.csproj
index a0a1e642..626a86ec 100644
--- a/.Source/GTweak/GTweak.csproj
+++ b/.Source/GTweak/GTweak.csproj
@@ -616,6 +616,7 @@
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
+ <ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
diff --git a/.Source/GTweak/Languages/en/Localize.xaml b/.Source/GTweak/Languages/en/Localize.xaml
index a2357c65..055b9d4d 100644
--- a/.Source/GTweak/Languages/en/Localize.xaml
+++ b/.Source/GTweak/Languages/en/Localize.xaml
@@ -88,7 +88,7 @@
<v:String x:Key="cmbox_it_main">Italiano (IT)</v:String>
<v:String x:Key="cmbox_ko_main">한국어 (KO)</v:String>
<v:String x:Key="cmbox_ru_main">Русский (RU)</v:String>
- <v:String x:Key="cmbox_uk_main">Українська (UK)</v:String>
+ <v:String x:Key="cmbox_uk_main">Українська (UA)</v:String>
<v:String x:Key="cmbox_theme_main">Interface theme:</v:String>
<v:String x:Key="cmbox_dark_main">Dark</v:String>
<v:String x:Key="cmbox_light_main">Light</v:String>
@@ -328,7 +328,7 @@
<v:String x:Key="TglButton3_description_services">Disable if you are connected to the Internet via cable or Wi-Fi.</v:String>
<v:String x:Key="TglButton4_description_services">Disable if you are not using the Windows Store and its UWP apps.</v:String>
<v:String x:Key="TglButton5_description_services">Disable if you do not want services to analyze the performance of your system.</v:String>
- <v:String x:Key="TglButton6_description_services">Disable if you do not use authorization using Windows Hello, fingerprint or face recognition.</v:String>
+ <v:String x:Key="TglButton6_description_services">Disable if you do not use sign-in with a PIN, fingerprint, facial recognition, or other Windows Hello methods. If a sign-in method has already been set up, it will continue to work, but you’ll need to re-enable Windows Hello to modify or remove it.</v:String>
<v:String x:Key="TglButton7_description_services">Disable if you do not use Bluetooth and devices whose work is connected to Bluetooth."</v:String>
<v:String x:Key="TglButton8_description_services">Disable if you don't have a printer.</v:String>
<v:String x:Key="TglButton9_description_services">Disable if you don't have a scanner.</v:String>
@@ -344,7 +344,7 @@
<v:String x:Key="TglButton19_description_services">Disable if you do not want the services to load your PC while they are handling errors.</v:String>
<v:String x:Key="TglButton20_description_services">Disable if you do not remotely manage files via Sharing or using WebDAV.</v:String>
<v:String x:Key="TglButton21_description_services">Disable if you are not using smart cards. A smart card is one of the varieties of electronic identifiers or plastic with a chip. The appearance is a «bank card». For everyday use of Windows, the service is not needed and you will never need it.</v:String>
- <v:String x:Key="TglButton22_description_services">Disable it if you’re not using Windows kiosk mode. This mode minimizes the interface: only a single UWP app runs full-screen, and all other features are blocked. Note that this may interfere with installing Windows updates and programs via Windows Installer, since it also disables the setup and initialization of system data and applications on first logon.</v:String>
+ <v:String x:Key="TglButton22_description_services">Disable if you’re not using Windows kiosk mode. This mode minimizes the interface: only a single UWP app runs full-screen, and all other features are blocked. Note that this may interfere with installing Windows updates and programs via Windows Installer, since it also disables the setup and initialization of system data and applications on first logon.</v:String>
<v:String x:Key="TglButton23_description_services">Disable if you do not use BitLocker disk encryption and EFS file or folder encryption.</v:String>
<v:String x:Key="TglButton24_description_services">Disable if you have configured all the languages that you will use and do not plan to add new ones.</v:String>
<v:String x:Key="TglButton25_description_services">Disable if you do not use Windows Defender and all additional Windows security.</v:String>
diff --git a/.Source/GTweak/Languages/fr/Localize.xaml b/.Source/GTweak/Languages/fr/Localize.xaml
index 01d29a27..5e642004 100644
--- a/.Source/GTweak/Languages/fr/Localize.xaml
+++ b/.Source/GTweak/Languages/fr/Localize.xaml
@@ -88,7 +88,7 @@
<v:String x:Key="cmbox_it_main">Italiano (IT)</v:String>
<v:String x:Key="cmbox_ko_main">한국어 (KO)</v:String>
<v:String x:Key="cmbox_ru_main">Русский (RU)</v:String>
- <v:String x:Key="cmbox_uk_main">Українська (UK)</v:String>
+ <v:String x:Key="cmbox_uk_main">Українська (UA)</v:String>
<v:String x:Key="cmbox_theme_main">Thème de l’interface :</v:String>
<v:String x:Key="cmbox_dark_main">Sombre</v:String>
<v:String x:Key="cmbox_light_main">Clair</v:String>
diff --git a/.Source/GTweak/Languages/it/Localize.xaml b/.Source/GTweak/Languages/it/Localize.xaml
index fb9be514..dea6d72c 100644
--- a/.Source/GTweak/Languages/it/Localize.xaml
+++ b/.Source/GTweak/Languages/it/Localize.xaml
@@ -88,7 +88,7 @@
<v:String x:Key="cmbox_it_main">Italiano (IT)</v:String>
<v:String x:Key="cmbox_ko_main">한국어 (KO)</v:String>
<v:String x:Key="cmbox_ru_main">Русский (RU)</v:String>
- <v:String x:Key="cmbox_uk_main">Українська (UK)</v:String>
+ <v:String x:Key="cmbox_uk_main">Українська (UA)</v:String>
<v:String x:Key="cmbox_theme_main">Tema dell'interfaccia:</v:String>
<v:String x:Key="cmbox_dark_main">Scuro</v:String>
<v:String x:Key="cmbox_light_main">Chiaro</v:String>
diff --git a/.Source/GTweak/Languages/ko/Localize.xaml b/.Source/GTweak/Languages/ko/Localize.xaml
index aad2231d..197d1b68 100644
--- a/.Source/GTweak/Languages/ko/Localize.xaml
+++ b/.Source/GTweak/Languages/ko/Localize.xaml
@@ -88,7 +88,7 @@
<v:String x:Key="cmbox_it_main">Italiano (IT)</v:String>
<v:String x:Key="cmbox_ko_main">한국어 (KO)</v:String>
<v:String x:Key="cmbox_ru_main">Русский (RU)</v:String>
- <v:String x:Key="cmbox_uk_main">Українська (UK)</v:String>
+ <v:String x:Key="cmbox_uk_main">Українська (UA)</v:String>
<v:String x:Key="cmbox_theme_main">인터페이스 테마:</v:String>
<v:String x:Key="cmbox_dark_main">어두운</v:String>
<v:String x:Key="cmbox_light_main">밝은</v:String>
diff --git a/.Source/GTweak/Languages/ru/Localize.xaml b/.Source/GTweak/Languages/ru/Localize.xaml
index a5207f7e..511e3685 100644
--- a/.Source/GTweak/Languages/ru/Localize.xaml
+++ b/.Source/GTweak/Languages/ru/Localize.xaml
@@ -88,7 +88,7 @@
<v:String x:Key="cmbox_it_main">Italiano (IT)</v:String>
<v:String x:Key="cmbox_ko_main">한국어 (KO)</v:String>
<v:String x:Key="cmbox_ru_main">Русский (RU)</v:String>
- <v:String x:Key="cmbox_uk_main">Українська (UK)</v:String>
+ <v:String x:Key="cmbox_uk_main">Українська (UA)</v:String>
<v:String x:Key="cmbox_theme_main">Тема интерфейса:</v:String>
<v:String x:Key="cmbox_dark_main">Тёмная</v:String>
<v:String x:Key="cmbox_light_main">Светлая</v:String>
@@ -328,7 +328,7 @@
<v:String x:Key="TglButton3_description_services">Отключайте, если вы подключены к интернету через кабель или Wi-Fi.</v:String>
<v:String x:Key="TglButton4_description_services">Отключайте, если вы не используете Магазин Windows и его UWP приложения.</v:String>
<v:String x:Key="TglButton5_description_services">Отключайте, если вы не хотите, чтобы службы анализировали производительность вашей системы.</v:String>
- <v:String x:Key="TglButton6_description_services">Отключайте, если вы не используете авторизацию с помощью Windows Hello, по отпечатку пальца или распзования лица.</v:String>
+ <v:String x:Key="TglButton6_description_services">Отключайте, если вы не используете вход по PIN-коду, отпечатку пальца, распознаванию лица или другим методам Windows Hello. Если какой-либо способ уже настроен, он продолжит работать, но для его изменения или удаления потребуется повторно включить Windows Hello.</v:String>
<v:String x:Key="TglButton7_description_services">Отключайте, если вы не используете Bluetooth и устройства чья работа связана с Bluetooth.</v:String>
<v:String x:Key="TglButton8_description_services">Отключайте, если у вас нет принтера.</v:String>
<v:String x:Key="TglButton9_description_services">Отключайте, если у вас нет сканера.</v:String>
diff --git a/.Source/GTweak/Languages/uk/Localize.xaml b/.Source/GTweak/Languages/uk/Localize.xaml
index d3ff90e9..9472a249 100644
--- a/.Source/GTweak/Languages/uk/Localize.xaml
+++ b/.Source/GTweak/Languages/uk/Localize.xaml
@@ -88,7 +88,7 @@
<v:String x:Key="cmbox_it_main">Italiano (IT)</v:String>
<v:String x:Key="cmbox_ko_main">한국어 (KO)</v:String>
<v:String x:Key="cmbox_ru_main">Русский (RU)</v:String>
- <v:String x:Key="cmbox_uk_main">Українська (UK)</v:String>
+ <v:String x:Key="cmbox_uk_main">Українська (UA)</v:String>
<v:String x:Key="cmbox_theme_main">Тема інтерфейсу:</v:String>
<v:String x:Key="cmbox_dark_main">Темна</v:String>
<v:String x:Key="cmbox_light_main">Світла</v:String>
diff --git a/.Source/GTweak/Properties/AssemblyInfo.cs b/.Source/GTweak/Properties/AssemblyInfo.cs
index c50d6b4b..9d2828ec 100644
--- a/.Source/GTweak/Properties/AssemblyInfo.cs
+++ b/.Source/GTweak/Properties/AssemblyInfo.cs
@@ -7,9 +7,9 @@ using System.Windows;
[assembly: AssemblyProduct("GTweak")]
[assembly: AssemblyCopyright("© 2024-2025 Greedeks")]
[assembly: AssemblyTrademark("Greedeks")]
-[assembly: AssemblyInformationalVersion("Build: 5.2.6")]
-[assembly: AssemblyVersion("5.2.27.327")]
-[assembly: AssemblyFileVersion("5.2.27.327")]
+[assembly: AssemblyInformationalVersion("Build: 5.2.7")]
+[assembly: AssemblyVersion("5.2.52.17")]
+[assembly: AssemblyFileVersion("5.2.52.17")]
[assembly: ComVisible(false)]
diff --git a/.Source/GTweak/Properties/AssemblyInfo.tt b/.Source/GTweak/Properties/AssemblyInfo.tt
index 1bf4fb0a..03cf9847 100644
--- a/.Source/GTweak/Properties/AssemblyInfo.tt
+++ b/.Source/GTweak/Properties/AssemblyInfo.tt
@@ -20,7 +20,7 @@ using System.Windows;
ResourceDictionaryLocation.SourceAssembly
)]
<#+
- private const string majorVersion = "Build: 5.2.6";
+ private const string majorVersion = "Build: 5.2.7";
private string GenerateVersion()
{
diff --git a/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs b/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs
index 9c910b79..b434676f 100644
--- a/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs
+++ b/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs
@@ -71,7 +71,11 @@ namespace GTweak.Utilities.Configuration
internal static ConnectionStatus CurrentConnection = ConnectionStatus.Lose;
- internal static string SystemDefaultLanguage => Regex.Replace(CultureInfo.CurrentUICulture.Name, @"-.+$", "", RegexOptions.Multiline);
+ internal static (string Сode, string Region) GetCurrentSystemLang()
+ {
+ Match systemLang = Regex.Match(CultureInfo.CurrentUICulture.Name, @"^(?<code>[a-z]{2,3})(?:-(?<region>[A-Za-z]{2,4}))?$", RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture | RegexOptions.CultureInvariant);
+ return (systemLang.Groups["code"].Value, systemLang.Groups["region"].Value);
+ }
internal static bool IsNeedUpdate { get; private set; } = false;
internal static string DownloadVersion { get; private set; } = string.Empty;
@@ -421,7 +425,7 @@ namespace GTweak.Utilities.Configuration
{
try
{
- string dns = SystemDefaultLanguage switch
+ string dns = GetCurrentSystemLang().Сode switch
{
"fa" => "aparat.com",
"zh" => "baidu.com",
diff --git a/.Source/GTweak/Utilities/Controls/SettingsEngine.cs b/.Source/GTweak/Utilities/Controls/SettingsEngine.cs
index 013a1f66..d6a99086 100644
--- a/.Source/GTweak/Utilities/Controls/SettingsEngine.cs
+++ b/.Source/GTweak/Utilities/Controls/SettingsEngine.cs
@@ -33,7 +33,7 @@ namespace GTweak.Utilities.Controls
["EnableIpBlur"] = true,
["EnableSound"] = true,
["VolumeLevel"] = 50,
- ["Language"] = SystemDiagnostics.SystemDefaultLanguage,
+ ["Language"] = SystemDiagnostics.GetCurrentSystemLang().Сode,
["Theme"] = "Dark"
};
diff --git a/.Source/GTweak/Utilities/Helpers/CommandExecutor.cs b/.Source/GTweak/Utilities/Helpers/CommandExecutor.cs
index df243a76..1857334d 100644
--- a/.Source/GTweak/Utilities/Helpers/CommandExecutor.cs
+++ b/.Source/GTweak/Utilities/Helpers/CommandExecutor.cs
@@ -58,7 +58,7 @@ namespace GTweak.Utilities.Helpers
Arguments = isPowerShell ? $"-NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command \"{command}\"" : command,
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = true,
- Verb = "runas",
+ Verb = "runas",
CreateNoWindow = true
});
});