November Happy Hour will be moved to Thursday December 5th.

Stephan Lonntorp
Nov 22, 2018
  2759
(2 votes)

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!

Nov 22, 2018

Comments

valdis
valdis Nov 23, 2018 06:55 AM

hmm.. think I should really dig into this built-in localization thingy and try to remove xpath based things there as well ;)

Stephan Lonntorp
Stephan Lonntorp Nov 23, 2018 08:09 AM

@valdis Totally off-topic, but why? The XML based localization stuff (or your DbLocalizationProvider for that matter) should, in my opinion, only be used for translation of the Episerver UI. Everything else is content, and should be managed as such.

Treating UI texts as content enables editors to do A/B testing, scheduling and anything else that the CMS allows. While your DbLocalizationProvider certainly solves the editability challenge that the XML-based system has, and is a fine piece of engineering, in my opinion it solves a problem that shouldn't be a problem.

valdis
valdis Nov 26, 2018 02:15 PM

because you would not have these stringly-typed problems ;)

Please login to comment.
Latest blogs
Optimizely SaaS CMS + Coveo Search Page

Short on time but need a listing feature with filters, pagination, and sorting? Create a fully functional Coveo-powered search page driven by data...

Damian Smutek | Nov 21, 2024 | Syndicated blog

Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Set Default Culture in Optimizely CMS 12

Take control over culture-specific operations like date and time formatting.

Tomas Hensrud Gulla | Nov 15, 2024 | Syndicated blog

I'm running Optimizely CMS on .NET 9!

It works 🎉

Tomas Hensrud Gulla | Nov 12, 2024 | Syndicated blog

Recraft's image generation with AI-Assistant for Optimizely

Recraft V3 model is outperforming all other models in the image generation space and we are happy to share: Recraft's new model is now available fo...

Luc Gosso (MVP) | Nov 8, 2024 | Syndicated blog