SaaS CMS has officially launched! Learn more now.

Stephan Lonntorp
Nov 22, 2018
  2671
(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 Concepts and Terminologies

Whether you're a new user of Optimizely CMS or a veteran who have been through the evolution of it, the SaaS CMS is bringing some new concepts and...

Patrick Lam | Jul 15, 2024

How to have a link plugin with extra link id attribute in TinyMce

Introduce Optimizely CMS Editing is using TinyMce for editing rich-text content. We need to use this control a lot in CMS site for kind of WYSWYG...

Binh Nguyen Thi | Jul 13, 2024

Create your first demo site with Optimizely SaaS/Visual Builder

Hello everyone, We are very excited about the launch of our SaaS CMS and the new Visual Builder that comes with it. Since it is the first time you'...

Patrick Lam | Jul 11, 2024

Integrate a CMP workflow step with CMS

As you might know Optimizely has an integration where you can create and edit pages in the CMS directly from the CMP. One of the benefits of this i...

Marcus Hoffmann | Jul 10, 2024

GetNextSegment with empty Remaining causing fuzzes

Optimizely CMS offers you to create partial routers. This concept allows you display content differently depending on the routed content in the URL...

David Drouin-Prince | Jul 8, 2024 | Syndicated blog

Product Listing Page - using Graph

Optimizely Graph makes it possible to query your data in an advanced way, by using GraphQL. Querying data, using facets and search phrases, is very...

Jonas Bergqvist | Jul 5, 2024