Loading...

Last updated: Oct 27 2016

Area: Episerver CMS Applies to versions: 10 and higher
Other versions:

Localizing the visitor group criterion

This topic describes how to localize your own visitor group criteria.

VisitorGroupCriterion settings localization

If you want to localize either DisplayNameCategory or Description when adding the VisitorGroupCriterion attribute, set the LanguagePath property. The property indicates a location in the language files, where the CMS looks for matching keys. If either DisplayName, Category or Description keys are found, the translation is used in the user interface.

Client-side localization

If you need translated string on the client, you have to register the string you need in the createUI method, which can look similar to the following code:

createUI: function(namingContainerPrefix, container, settings) {
           this.languageKeys = [
            '/xml/path/to/languageKey1',
            '/xml/path/to/languageKey2' ];
            this.prototype.createUI.apply(this, arguments);
           }</li>

After this is done, you can access the translated value by using the following syntax:

validate: function(namingContainerPrefix, validationUtil) {
 ...
   this.translatedText['/xml/path/to/languageKey2']
 ...
}

Enumeration localization

If you use the EnumSelectionFactory and want the names translated, add matching keys under the enumerators part of the language files. For an enum called EPiServer.Sample.Criteria.Answer, the keys can look similar to the following code:

<enums>
  <episerver>
     <sample>
        <criteria>
           <answer>
             <yes>Oh yes!</yes>
             <no>No way!</no>
           </answer>
        </criteria>
     </sample>
  </episerver>
</enums>

 


Do you have feedback on this documentation? Send an email to documentation@episerver.com. For development-related questions and discussions, refer to our Forums on https://world.episerver.com/forum/