How to localize Dynamic Content

by: Paul Smith

Strings displayed for a Dynamic Content class in the EPiServer CMS 5 R2 Editor can be localized in the same manner as any other part of EPiServer, via an XML file in the 'lang' folder of the site.

Localizing the name and description

When you register a Dynamic Content class in the web.config file, you add a name and description attribute which then shows up in the EPiServer Editor when the {} button is clicked. To localize these you need to add elements to the <dynamiccontenttypes> element in your lang file. For example, if you have a Dynamic Content type registered in web.config with the name 'DateTime' then you would add the following XML block to the <dynamiccontenttypes> element:

<dynamiccontent name="DateTime">
  <caption>My localized DateTime name</caption>
  <description>My localized DateTime description</description>
</dynamiccontent>

If your Dynamic Content class exposes properties through IDynamicContent.Properties then you probably also want to localize the names of those as well. Because they are EPiServer Properties they are localized in exactly the same way as other EPiServer Properties. If you expose a property called 'ShowTime' then you add a new <property> element to the <pagetypes><common> element:

<property name="ShowTime">
  <caption>My localized property name</caption>
</property>

You will find an example lang file here.

09 October 2008


Comments

Post a comment    
User verification Image for user verification  
EPiTrace logger