Nov 8, 2011 at 3:11 PM

Any idea how the "Type instanceType" parameters are meant to be used in ILocalizationService?

    public interface ILocalizationService
        string GetString(Type instanceType, string key);
        object GetTooltip(Type instanceType, string key);       

Nov 8, 2011 at 3:48 PM

The localization service for the property editor is based on the type of the instance being edited (instanceType) and the name of the property (key).

GetString provides the header (display name) for the property, and GetToolTip provides the description (shown in a tool tip).

I have not tested this with "satellite" resource assemblies, I have been using other solutions for localization. Let us know if you know a way to improve this!

Nov 8, 2011 at 4:26 PM

I just did a quick test using a satellite resource assembly and it worked as expected. Nice.

Thanks for the explanation objo, but I'm still unclear as to what the intent is for using the instanceType. It seems to be the type of the SelectedObject as set in the xaml. What is the intent or motivation for using this information?

Nov 9, 2011 at 6:42 PM

Are you localizing DisplayName and Description attributes? By deriving these attribute classes? 

I have tried using the System.ComponentModel.DataAnnotations.DisplayAttribute, but it does not seem to be used by the TypeDescriptor.

I can add support for the DisplayAttribute (using ResourceManager) - then the following domain model could be localized

    public class Class1
        [Display(ResourceType = typeof(Resources), Name = "Name", Description = "NameDescription")]
        public string Name { get; set; }

Localization seems to be a complex topic, ref., would really like to see some good solution to this...

Mar 15, 2012 at 7:42 PM

Hijacking this thread...

I might be missing something, but is localization not supported in the new PropertyControl?

Mar 17, 2012 at 1:23 PM

Subclass the DefaultPropertyItemFactory and override the GetLocalizedDescription/String methods. I did not use a ILocalizationService for the PropertyControl. Remember to set the "PropertyItemFactory" in the PropertyControl to your new implementation.

Aug 10, 2012 at 7:51 PM

Subclassing DefaultPropertyItemFactory works well. Nice design. Very easy to point it at a resource or whatever in GetLocalized... method.


You idea of using the DisplayAttribute would be a nice touch for those who want to go that way.