Schema localization


Labels and texts in schemas can be displayed in the users preferred language (based on browser settings).

Simply add an i18n="key" attribute to the form elements. The key mustmatch an entry in your application’s src/main/resources/i18n/ file.

Schema localization uses the same properties files format as the rest of XP. Please consult the framework localization docs for more details.

Localization is optional. If the i18n attribute is not specified, the value of the XML element will be used.


Below is an example of a content type where localization has been enabled.

Localized content type schema
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  <display-name i18n="person.display-name">Person</display-name>
    <input type="TextLine" name="name">
      <label i18n="">Name</label>
      <occurrences minimum="1" maximum="1"/>
    <input type="TextLine" name="age">
      <label i18n="person.age.label">Age</label>
      <occurrences minimum="1" maximum="1"/>
    <input type="imageSelector" name="photo">
      <label i18n="">Photo</label>
      <help-text i18n="">Passport photo</help-text>
      <occurrences minimum="0" maximum="1"/>

Supported Fields

In general, the following schema elements support the i18n localization attribute:

  • displayName

  • label

  • help-text

  • description

Other elements may also support localization, simply try adding the attribute to see if it works.

Translation files

The translated texts for each of the i18n keys should be placed in the corresponding file within the same application where the schema is defined.

Steps to add the translations for a schema:

  1. Add or edit one file per language supported:


    Example files to support English and Norwegian
  2. Add the i18n keys from the schema in each of the files.

    Each line should have the key, an equals = sign, and the text in the specific language.
    person.age.label=Age photo
  3. fallback file file

    It is recommended to have default phrases file. This will be used if the translation for the browser language cannot be found.

For more details, check out the runtime localization docs