Instantly share code, notes, and snippets.

Embed
What would you like to do?
Extended WPF Toolkit PropertyGrid ローカライズ (国際化/多言語対応)
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) { }
}
}
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