diff --git a/ILSpy/Controls/CultureSelectionConverter.cs b/ILSpy/Controls/CultureSelectionConverter.cs
new file mode 100644
index 000000000..0e79cf105
--- /dev/null
+++ b/ILSpy/Controls/CultureSelectionConverter.cs
@@ -0,0 +1,41 @@
+// Copyright (c) 2021 Siegfried Pammer
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
+// software and associated documentation files (the "Software"), to deal in the Software
+// without restriction, including without limitation the rights to use, copy, modify, merge,
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+// to whom the Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or
+// substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE
+
+using System;
+using System.Globalization;
+using System.Windows.Data;
+
+namespace ICSharpCode.ILSpy.Controls
+{
+ public class CultureSelectionConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is string s)
+ return s.Equals(parameter);
+ return value == parameter;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if ((bool)value)
+ return parameter;
+ return Binding.DoNothing;
+ }
+ }
+}
diff --git a/ILSpy/MainWindow.xaml b/ILSpy/MainWindow.xaml
index 5dbd9b720..99852bbcf 100644
--- a/ILSpy/MainWindow.xaml
+++ b/ILSpy/MainWindow.xaml
@@ -7,10 +7,8 @@
xmlns:avalondock="https://github.com/Dirkster99/AvalonDock"
xmlns:controls="clr-namespace:ICSharpCode.ILSpy.Controls"
xmlns:docking="clr-namespace:ICSharpCode.ILSpy.Docking"
- xmlns:textview="clr-namespace:ICSharpCode.ILSpy.TextView"
xmlns:analyzers="clr-namespace:ICSharpCode.ILSpy.Analyzers"
xmlns:properties="clr-namespace:ICSharpCode.ILSpy.Properties"
- xmlns:viewmodels="clr-namespace:ICSharpCode.ILSpy.ViewModels"
Title="ILSpy"
MinWidth="250"
MinHeight="200"
@@ -62,6 +60,8 @@
+
+
@@ -102,6 +102,12 @@
+
+
diff --git a/ILSpy/MainWindow.xaml.cs b/ILSpy/MainWindow.xaml.cs
index 95fb99746..e1b8b2d2a 100644
--- a/ILSpy/MainWindow.xaml.cs
+++ b/ILSpy/MainWindow.xaml.cs
@@ -121,7 +121,10 @@ namespace ICSharpCode.ILSpy
};
AssemblyListManager.CreateDefaultAssemblyLists();
-
+ if (!string.IsNullOrEmpty(sessionSettings.CurrentCulture))
+ {
+ System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(sessionSettings.CurrentCulture);
+ }
DockWorkspace.Instance.LoadSettings(sessionSettings);
InitializeComponent();
InitToolPanes();
@@ -137,16 +140,19 @@ namespace ICSharpCode.ILSpy
private void SessionSettings_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
- if (e.PropertyName == "ActiveAssemblyList")
+ switch (e.PropertyName)
{
- ShowAssemblyList(sessionSettings.ActiveAssemblyList);
- }
-
- if (e.PropertyName == nameof(SessionSettings.IsDarkMode))
- {
- // update syntax highlighting and force reload (AvalonEdit does not automatically refresh on highlighting change)
- DecompilerTextView.RegisterHighlighting();
- DecompileSelectedNodes(DockWorkspace.Instance.ActiveTabPage.GetState() as DecompilerTextViewState);
+ case nameof(SessionSettings.ActiveAssemblyList):
+ ShowAssemblyList(sessionSettings.ActiveAssemblyList);
+ break;
+ case nameof(SessionSettings.IsDarkMode):
+ // update syntax highlighting and force reload (AvalonEdit does not automatically refresh on highlighting change)
+ DecompilerTextView.RegisterHighlighting();
+ DecompileSelectedNodes(DockWorkspace.Instance.ActiveTabPage.GetState() as DecompilerTextViewState);
+ break;
+ case nameof(SessionSettings.CurrentCulture):
+ MessageBox.Show(Properties.Resources.SettingsChangeRestartRequired, "ILSpy");
+ break;
}
}
diff --git a/ILSpy/Options/DisplaySettings.cs b/ILSpy/Options/DisplaySettings.cs
index 154056659..ceb55f10e 100644
--- a/ILSpy/Options/DisplaySettings.cs
+++ b/ILSpy/Options/DisplaySettings.cs
@@ -291,7 +291,7 @@ namespace ICSharpCode.ILSpy.Options
this.IndentationSize = s.indentationSize;
this.HighlightMatchingBraces = s.highlightMatchingBraces;
this.HighlightCurrentLine = s.highlightCurrentLine;
- this.HideEmptyMetadataTables = s.HideEmptyMetadataTables;
+ this.HideEmptyMetadataTables = s.hideEmptyMetadataTables;
}
}
}
diff --git a/ILSpy/Properties/Resources.Designer.cs b/ILSpy/Properties/Resources.Designer.cs
index a12ee2f4d..d16bf7064 100644
--- a/ILSpy/Properties/Resources.Designer.cs
+++ b/ILSpy/Properties/Resources.Designer.cs
@@ -2219,6 +2219,15 @@ namespace ICSharpCode.ILSpy.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to You must restart ILSpy for the change to take effect..
+ ///
+ public static string SettingsChangeRestartRequired {
+ get {
+ return ResourceManager.GetString("SettingsChangeRestartRequired", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Shell.
///
@@ -2462,6 +2471,15 @@ namespace ICSharpCode.ILSpy.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to System.
+ ///
+ public static string UILanguage_System {
+ get {
+ return ResourceManager.GetString("UILanguage_System", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to No update for ILSpy found..
///
diff --git a/ILSpy/Properties/Resources.resx b/ILSpy/Properties/Resources.resx
index 8ffe3b836..14cb244e3 100644
--- a/ILSpy/Properties/Resources.resx
+++ b/ILSpy/Properties/Resources.resx
@@ -768,6 +768,9 @@ Do you want to continue?
Select version of language to output
+
+ You must restart ILSpy for the change to take effect.
+
Shell
@@ -849,6 +852,9 @@ Do you want to continue?
Type
+
+ System
+
No update for ILSpy found.
diff --git a/ILSpy/SessionSettings.cs b/ILSpy/SessionSettings.cs
index b3c037c5b..5f5e9cd1f 100644
--- a/ILSpy/SessionSettings.cs
+++ b/ILSpy/SessionSettings.cs
@@ -62,6 +62,8 @@ namespace ICSharpCode.ILSpy
this.BottomPaneSplitterPosition = FromString((string)doc.Element("BottomPaneSplitterPosition"), 0.3);
this.SelectedSearchMode = FromString((string)doc.Element("SelectedSearchMode"), SearchMode.TypeAndMember);
this.IsDarkMode = FromString((string)doc.Element(nameof(IsDarkMode)), false);
+ string currentCulture = (string)doc.Element(nameof(CurrentCulture));
+ this.CurrentCulture = string.IsNullOrEmpty(currentCulture) ? null : currentCulture;
this.DockLayout = new DockLayoutSettings(doc.Element("DockLayout"));
}
@@ -87,6 +89,19 @@ namespace ICSharpCode.ILSpy
public string[] ActiveTreeViewPath;
public string ActiveAutoLoadedAssembly;
+ string currentCulture;
+
+ public string CurrentCulture {
+ get { return currentCulture; }
+ set {
+ if (currentCulture != value)
+ {
+ currentCulture = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
public string ActiveAssemblyList {
get => activeAssemblyList;
set {
@@ -132,6 +147,10 @@ namespace ICSharpCode.ILSpy
doc.Add(new XElement("BottomPaneSplitterPosition", ToString(this.BottomPaneSplitterPosition)));
doc.Add(new XElement("SelectedSearchMode", ToString(this.SelectedSearchMode)));
doc.Add(new XElement(nameof(IsDarkMode), ToString(this.IsDarkMode)));
+ if (this.CurrentCulture != null)
+ {
+ doc.Add(new XElement(nameof(CurrentCulture), this.CurrentCulture));
+ }
var dockLayoutElement = new XElement("DockLayout");
if (DockLayout.Valid)