If your implementation supports multiple locales, you can localize your custom templates.

You can create resource property files for each locale for storing localized strings. Each resource property file name must follow this format: Resources_<locale>.properties where <locale> is the ISO language code. For example Resources_fr.properties indicates that French values are stored in it. Place these files in a locales folder for your custom template: <app dir>\config\cartridge_templates\<template_identifier>\locales. You can specify values that do not change for locale (thumbnail URLs for example) in the single Resources.properties file or directly in the JSON file.

In the template itself, you can use ${property.name} notation in element content and attributes to reference a localized string in the Resources_<locale>.properties. Only content in the @description, @thumbnailURL, and editorPanel sections can reference localized strings in the resources properties files.

The following example shows a template that uses notation to reference strings in resource properties files and two resource property files containing the stings that are being referenced.

{
    "ecr:type": "template",
    "@group": "MainContent",
    "@description": "${my.template.description}",
    "@thumbnailUrl": ${my.template.thumbnail}",
    "defaultContentItem": {
        ...CONTENT OMITTED FOR EXAMPLE...
     },
    "editorPanel": {
        "editor": "editors/DefaultEditorPanel",
        "children": [
            {
                "editor": "editors/NumericStepperEditor",
                "label": "${my.template.recordsPerPage.label}",
                "maxValue": "100",
                "minValue": "10",
                "propertyName": "recordsPerPage"
            },
            {
                "editor": "editors/BoostBuryRecordEditor",
                "buryProperty": "buryStrata",
                "label": "${my.template.boostBury.label}",
                "propertyName": "boostStrata"
            },
        ...CONTENT OMITTED FOR EXAMPLE...             
        ]
    }
}

The English resources property file, Resources_en.properties, for this template contains the following:

# Main Content
my.template.description = Container for main content cartridges.
my.template.recordsPerPage.label = Records Per Page
my.template.boostBury.label = Boost and Bury Records


In the template example, the thumbnail URL is the same for all locales, so the ${my.template.thumbnailurl} notation is only referenced in the Resources.properties file.

# Main Content
my.template.thumbnailurl = /ifcr/tools/xmgr/img/template_thumbnails/maincontent2.jpg


Copyright © Legal Notices