Try our conversational search powered by Generative AI!

Stephan Lonntorp
Nov 22, 2018
  2634
(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 and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog

Azure AI Language – Abstractive Summarisation in Optimizely CMS

In this article, I show how the abstraction summarisation feature provided by the Azure AI Language platform, can be used within Optimizely CMS to...

Anil Patel | Apr 18, 2024 | Syndicated blog

Fix your Search & Navigation (Find) indexing job, please

Once upon a time, a colleague asked me to look into a customer database with weird spikes in database log usage. (You might start to wonder why I a...

Quan Mai | Apr 17, 2024 | Syndicated blog