Localize page type and page property names in EPiServer

Denna artikel har migrerats från en tidigare version av vår webbplats och kan därför avvika i utseende och funktionalitet.

Den här artikeln är inte översatt till svenska och visas därför på engelska istället.


This post shows how to translate page type and property names and descriptions to have them appear in the correct language in the editor interface when globalization is enabled for an EPiServer web site.

Uppskattad lästid : 4 minuter

Gå till avsnitt

Strategy for page type and property names and help texts

I usually recommend using english for things such as page type and property names, with localized names stored in EPiServer language files.

This results in the following approach to handling properties including their appearance in the edit interface:

  1. Add page types and page properties through the admin interface using english property names, edit headings and help texts
  2. Once done, add a pagetypes.xml language file to your EPiServer site (you may of course complement existing language files if preferred)
  3. Add the pagetypes element to your language file like the following (demonstrates how to translate the edit heading and help text of a page property):
<?xml version="1.0" encoding="utf-8" ?>
<languages>
   <language name="English" id="EN">
      <pagetypes>
         <common>
            <property name="MyPageProperty">
               <caption>My Page Property</caption>
               <help>This is a page property used for demos</help>
            </property>
         </common>
      </pagetypes>
   </language>
 
   <language name="Svenska" id="SV">
      <pagetypes>
         <common>
            <property name="MyPageProperty">
               <caption>Min sidegenskap</caption>
               <help>Detta är en sidegenskap för demosyften</help>
            </property>
         </common>
      </pagetypes>
   </language>
</languages>

Localizing page type names and descriptions

In addition to page property edit headings and help texts you will want to have the page type names appear in the correct language in the edit interface.

In order to have the translated page type names and descriptions appear in the edit interface you complement your XML language file with the following:

<?xml version="1.0" encoding="utf-8" ?>
<languages>
   <language name="English" id="EN">
      <pagetypes>
         <pagetype name="MyPageType">
            <description>This is my demo page type</description>
            <name>[Demo] My Page Type</name>
         </pagetype>
      </pagetypes>
   </language>
 
   <language name="Svenska" id="SV">
      <pagetypes>
         <pagetype name="MyPageType">
            <description>Detta är min demo-sidtyp</description>
            <name>[Demo] Min sidtyp</name>
         </pagetype>
      </pagetypes>
   </language>
</languages>