af:format, af:format1, af:format2, af:format3, af:format4 can be used to localize messages using parameters.
Example:
Scenario: I need to show following message on delete:
Example:
Scenario: I need to show following message on delete:
You are about to delete <change set name> and all of the pricing objects in it. This operation cannot be undone. Continue?
In XLIFF file I declared the resource string as:
<trans-unit id="YOU_ARE_ABOUT_TO_DELETE_0_AND_">
<source>You are about to delete <i>{0}</i> and all of the pricing objects in it.<br>This operation cannot be undone. Continue?</source>
</trans-unit>
In my JSFF I have to access this resource and pass the change set name as the value to the token in the message:
<c:set var="csName" value="#{bindings.privateChangeSetsIterator.currentRow.dataProvider.name }"/>
<af:outputFormatted value="#{af:format(pdcviewcontrollerBundle.YOU_ARE_ABOUT_TO_DELETE_0_AND_, csName)}" id="of1"/>
Note the af:format function above. Likewise you can use af:format2 for 2 tokens, af:format3 for 3 tokens and af:format4 for 4 tokens. No need to form the message using java code.<af:outputFormatted value="#{af:format(pdcviewcontrollerBundle.YOU_ARE_ABOUT_TO_DELETE_0_AND_, csName)}" id="of1"/>
No comments:
Post a Comment