You can also localize the string values that correspond to each option value in an enumerated property, using the resource
attribute in the <option>
tag. As with label attributes, a localized enumerated property needs to have a resource bundle defined for it at either the property, table, or item descriptor level. Then, you can specify the resource key that holds the localized string value using the resource
attribute, as in this example:
<property name="emailStatus" ... data-type="enumerated" ...>
<option resource="emailStatusUnknown" code="0"/>
...
When you specify a default, use the resource name as the value, such as:
<property name="emailStatus" ... data-type="enumerated" default="emailStatusUnknown" ... > <attribute name="useCodeForValue" value="false"/> <option resource="emailStatusUnknown" code="0"/> <option resource="emailStatusValid" code="1"/> <option resource="emailStatusInvalid" code="2"/> </property>
Use caution when localizing the strings used for enumerated types. Remember that if you have useCodeForValue
set to false
, calling getPropertyValue
will not return the localized property value. If you want to display the localized value on a page, you need to include the localized string in your page, using a Switch
servlet bean to choose the proper value.
For more information about resource bundles and localization, see the Internationalizing a Dynamo Web Site chapter in the ATG Programming Guide.