CMS, EpiServer

Localizing Properties for Editors in Episerver

It is very useful if we can localize the Properties and Group Names for the Editor in All Properties view. In order to do localization we need to create the xml file and specify data specific to that language

Specify Localization path in Web.config file in episerver.framework node

<localization fallbackBehavior=”Echo, MissingMessage, FallbackCulture” fallbackCulture=”en”>
<providers>
<add virtualPath=”~/Resources/LanguageFiles” name=”languageFiles” type=”EPiServer.Framework.Localization.XmlResources.FileXmlLocalizationProvider, EPiServer.Framework” />
</providers>
</localization>

SitePageData Model has the following properties

using EPiServer.Core;
using EPiServer.DataAbstraction;
using EPiServer.DataAnnotations;
using EPiServer.Web;
using System.ComponentModel.DataAnnotations;

namespace AlloyTraining.Models.Pages
{
public abstract class SitePageData:PageData
{
[CultureSpecific]
[Display(Name = “Meta title”, GroupName = SiteTabNames.SEO, Order = 100)]
public virtual string MetaTitle { get; set; }
[CultureSpecific]
[Display(Name = “Meta keywords”, GroupName = SiteTabNames.SEO, Order = 200)]
public virtual string MetaKeywords { get; set; }
[CultureSpecific]
[Display(Name = “Meta description”, GroupName = SiteTabNames.SEO, Order = 300)]
[UIHint(UIHint.Textarea)] // multi-row text editor
public virtual string MetaDescription { get; set; }

}

}

Properties in the AllProperties Tab in English looks as shown below

Localizing Properties in Svenska in XML file

<?xml version=”1.0″ encoding=”utf-8″?>
<languages>
<language name=”Svenska” id=”sv”>
<contenttypes>
<icontentdata>
<properties>
<!– SitePageData –>
<disableindexing>
<caption>Disable indexing</caption>
<help>Prevents the page from being indexed by search engines</help>
</disableindexing>
<metadescription>
<caption>Sidbeskrivning</caption>
<help>Används som meta beskrivning och allmänt som en ingress</help>
</metadescription>
<metakeywords>
<caption>Nyckelord</caption>
</metakeywords>
<metatitle>
<caption>Titel</caption>
</metatitle>

</properties>
</icontentdata>

</contenttypes>
</language>
</languages>

Click on Admin and Go to MySettings Intially Personal Language will be in English

 

Change the Personal Language to Svenska

 

Properties in Svenska in AllProperties Tab looks as shown below

By Localizing the Properties Editors can easily Edit the properties in the specific language without any confusion.

About The Author

Leave a Reply

*