Localizations in PropertyValueList
The PropertyValueList property type ca be really useful for things that don't have a need for reuse, or doesn't have a view. If you've used it you might have noticed that the editor experience, especially in regards to localizations, hasn't been optimal.
In Per's blog post from 2015, the question on how to localize arose, and Kai de Leuw answered with:
[Display(Name="/path/to/lang/resource")]
That worked really well, up until a few weeks ago.
In Episerver CMS UI 11.12, something was introduced, that broke this functionality. But have no fear, it can still be done, and it's even cleaner.
Now, your POCOs are localized in the same way that other content types are localized.
Provided you have a POCO like this:
public class Contact {
public string Name { get; set; }
public string Country { get; set; }
}
You can localize it with an XML like this:
<?xml version="1.0" encoding="utf-8"?>
<languages>
<language name="English" id="en">
<contenttypes>
<Contact>
<properties>
<Name>
<caption>Contact name</caption>
<help>The name of the contact.</help>
</Name>
<Country>
<caption>Country of origin</caption>
<help>The country of origin for the contact.</help>
</Country>
</properties>
</Contact>
</contenttypes>
</language>
</languages>
Happy localizing!
Comments