File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change 1616using Shadowsocks . Controller . Strategy ;
1717using Shadowsocks . Model ;
1818using Shadowsocks . Util ;
19+ using WPFLocalizeExtension . Engine ;
1920
2021namespace Shadowsocks . Controller
2122{
@@ -172,6 +173,8 @@ protected void Reload()
172173
173174 NLogConfig . LoadConfiguration ( ) ;
174175
176+ logger . Info ( $ "WPF Localization Extension|Current culture: { LocalizeDictionary . CurrentCulture } ") ;
177+
175178 // set User-Agent for httpClient
176179 try
177180 {
Original file line number Diff line number Diff line change 1717using Shadowsocks . Util ;
1818using Shadowsocks . View ;
1919using Splat ;
20+ using WPFLocalizeExtension . Engine ;
2021
2122namespace Shadowsocks
2223{
@@ -116,6 +117,12 @@ private static void Main(string[] args)
116117 // Parameters would have to be dropped from views' constructors (VersionUpdatePromptView)
117118 //Locator.CurrentMutable.RegisterViewsForViewModels(Assembly.GetCallingAssembly());
118119
120+ // Workaround for hosting WPF controls in a WinForms app.
121+ // We have to manually set the culture for the LocalizeDictionary instance.
122+ // https://stackoverflow.com/questions/374518/localizing-a-winforms-application-with-embedded-wpf-user-controls
123+ // https://stackoverflow.com/questions/14668640/wpf-localize-extension-translate-window-at-run-time
124+ LocalizeDictionary . Instance . Culture = Thread . CurrentThread . CurrentCulture ;
125+
119126#if DEBUG
120127 // truncate privoxy log file while debugging
121128 string privoxyLogFilename = Utils . GetTempPath ( "privoxy.log" ) ;
You can’t perform that action at this time.
0 commit comments