Skip to content

Commit 1c0c239

Browse files
committed
Set UI thread culture before loading the Ninject module to correctly set window caption language.
1 parent b364283 commit 1c0c239

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

RetailCoder.VBE/Extension.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66
using Rubberduck.UI;
77
using System;
88
using System.ComponentModel;
9+
using System.Globalization;
910
using System.IO;
1011
using System.Reflection;
1112
using System.Runtime.InteropServices;
1213
using System.Windows.Forms;
14+
using System.Windows.Threading;
1315
using Ninject.Extensions.Interception;
1416
using NLog;
17+
using Rubberduck.Settings;
18+
using Rubberduck.SettingsProvider;
1519

1620
namespace Rubberduck
1721
{
@@ -46,6 +50,24 @@ public void OnConnection(object Application, ext_ConnectMode ConnectMode, object
4650
{
4751
var currentDomain = AppDomain.CurrentDomain;
4852
currentDomain.AssemblyResolve += LoadFromSameFolder;
53+
54+
var config = new XmlPersistanceService<GeneralSettings>
55+
{
56+
FilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Rubberduck",
57+
"rubberduck.config")
58+
};
59+
60+
var settings = config.Load(null);
61+
if (settings != null)
62+
{
63+
try
64+
{
65+
var cultureInfo = CultureInfo.GetCultureInfo(settings.Language.Code);
66+
Dispatcher.CurrentDispatcher.Thread.CurrentUICulture = cultureInfo;
67+
}
68+
catch (CultureNotFoundException) { }
69+
}
70+
4971
_kernel.Load(new RubberduckModule((VBE)Application, (AddIn)AddInInst));
5072
_app = _kernel.Get<App>();
5173
_app.Startup();

0 commit comments

Comments
 (0)