Skip to content

Commit a39feb7

Browse files
committed
Fix keyboard layout detection
1 parent b0e8108 commit a39feb7

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

Editor/Gui/Dialog/AboutDialog.cs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using T3.Editor.Gui.Styling;
99
using T3.Editor.Gui.UiHelpers;
1010
using T3.Editor.App;
11+
using System.Windows.Forms;
1112

1213

1314
namespace T3.Editor.Gui.Dialog;
@@ -106,8 +107,8 @@ private void UpdateSystemInfo()
106107
#endif
107108
systemInfo.AppendLine($"App language: {GetAppLanguage()}");
108109
systemInfo.AppendLine($"OS: {GetOperatingSystemInfo()}");
109-
systemInfo.AppendLine($"System language: {GetSystemLanguage(englishName: true)}");
110-
systemInfo.AppendLine($"Keyboard Layout: {GetSystemLanguage(englishName: false)}");
110+
systemInfo.AppendLine($"System language: {GetSystemLanguage()}");
111+
systemInfo.AppendLine($"Keyboard Layout: {GetKeyboardLayout()}");
111112
systemInfo.AppendLine($".NET runtime: {GetDotNetRuntimeVersion()}");
112113
systemInfo.AppendLine($".NET SDK: {GetDotNetSdkVersion()}");
113114
systemInfo.AppendLine($"GPU: {GetGpuInformation()}");
@@ -128,14 +129,25 @@ private static string GetOperatingSystemInfo()
128129
return $"{osDescription} ({osArchitecture})";
129130
}
130131

131-
private static string GetSystemLanguage(bool englishName = true)
132+
private static string GetSystemLanguage()
132133
{
133134
try
134135
{
135136
var currentCulture = CultureInfo.CurrentUICulture;
136-
return englishName
137-
? currentCulture.EnglishName
138-
: $"{currentCulture.KeyboardLayoutId} ({currentCulture.Parent})";
137+
return currentCulture.EnglishName;
138+
}
139+
catch (Exception)
140+
{
141+
return "Unknown";
142+
}
143+
}
144+
145+
private static string GetKeyboardLayout()
146+
{
147+
try
148+
{
149+
var currentInputLanguage = InputLanguage.CurrentInputLanguage;
150+
return $"{currentInputLanguage.Culture.Name}";
139151
}
140152
catch (Exception)
141153
{
@@ -270,8 +282,8 @@ private static string GetIdeName()
270282
private static readonly string dateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
271283

272284
private static readonly string operatingSystemInfo = GetOperatingSystemInfo();
273-
private static readonly string systemLanguage = GetSystemLanguage(englishName: true);
274-
private static readonly string keyboardLayout = GetSystemLanguage(englishName: false);
285+
private static readonly string systemLanguage = GetSystemLanguage();
286+
private static readonly string keyboardLayout = GetKeyboardLayout();
275287
private static readonly string dotNetRuntime = GetDotNetRuntimeVersion();
276288
private static readonly string dotNetSdk = GetDotNetSdkVersion();
277289
private static readonly string gpuInformation = GetGpuInformation();

0 commit comments

Comments
 (0)