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
template.xm
l 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.
<ContentTemplate xmlns="http://endeca.com/schema/content-template/2008" xmlns:editors="editors" type="Type"> <Description>${my.template.description}</Description> <ThumbnailUrl>${my.template.thumbnailurl}</ThumbnailUrl> <ContentItem> <Name>Dimension Search Auto-Suggest</Name> <Property name="title"> <String>Search Suggestions:</String> </Property> <Property name="displayImage"> <Boolean>true</Boolean> </Property> </ContentItem> <EditorPanel> <BasicContentItemEditor> <GroupLabel label="${my.template.displaySettingsLabel}"/> <editors:StringEditor propertyName="title" label="${my.template.titleLabel}" enabled="true"/> <editors:BooleanEditor propertyName="displayImage" label="${my.template.displayImageLabel}" enabled="true"/> <editors:NumericStepperEditor propertyName="maxResults" label="${my.template.maxSearchSuggestionsLabel}" maxValue="100" enabled="true"/> </BasicContentItemEditor> </EditorPanel> </ContentTemplate>
The English resources property file,
Resources_en.properties
, for this template contains
the following:
# Dimension Search Auto-Suggest my.template.description = Display dimension matches as part of the auto-suggest panel below the search box. my.template.displaySettingsLabel = Display Settings my.template.titleLabel = Title my.template.displayImageLabel = Display Image my.template.maxSearchSuggestionsLabel = Max Search Suggestions
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.
# Dimension Search Auto-Suggest my.template.thumbnailurl = /ifcr/tools/xmgr/img/template_thumbnails/type_ahead_2.jpg