Last active
September 24, 2018 12:07
-
-
Save kenzauros/0d61bb42fb3410a238f896234a8cad19 to your computer and use it in GitHub Desktop.
Extended WPF Toolkit PropertyGrid ローカライズ (国際化/多言語対応)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.ComponentModel; | |
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes; | |
namespace YourApplication | |
{ | |
internal class LocalizedCategoryAttribute : CategoryAttribute | |
{ | |
public LocalizedCategoryAttribute(string resourceKey) | |
: base(LocalizedResources.GetString(resourceKey)) { } | |
} | |
internal class LocalizedDisplayNameAttribute : DisplayNameAttribute | |
{ | |
public LocalizedDisplayNameAttribute(string resourceKey) | |
: base(LocalizedResources.GetString(resourceKey)) { } | |
} | |
internal class LocalizedDescriptionAttribute : DescriptionAttribute | |
{ | |
public LocalizedDescriptionAttribute(string resourceKey) | |
: base(LocalizedResources.GetString(resourceKey)) { } | |
} | |
internal class LocalizedCategoryOrderAttribute : CategoryOrderAttribute | |
{ | |
public LocalizedCategoryOrderAttribute(string resourceKey, int order) | |
: base(LocalizedResources.GetString(resourceKey), order) { } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Resources; | |
namespace YourApplication | |
{ | |
internal static class LocalizedResources | |
{ | |
readonly static ResourceManager _ResourceManager = new ResourceManager(typeof(Resources)); | |
public static string GetString(string resourceKey) | |
{ | |
return _ResourceManager.GetString(resourceKey) ?? resourceKey; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment