Home > Contents > Index >
Template Tags TOC | Alpha TOC | Tag Family TOC | Purpose TOC | Annotated TOC | Index
xlat:lookup
A tag which looks up a locale-specific string, and encodes it appropriately for an HTML or Javascript environment.
Syntax
<xlat:lookup
key="localization key"
varname="variable name"
[locale="locale key"]
[escape="true|false"]
[encode="true|false"]
[evalall="true|false"]>
<xlat:argument name="argument name" value="argument value"/>
...
</xlat:lookup>
Parameters
key (required)
- Input. The name of the key to look up in the
SystemLocaleString
table.
varname (required)
- Input. The name of the variable to create with the localized and potentially encoded string.
locale (optional)
- Input. The name of the locale to use for the localized string lookup (e.g.
en_US
).
encode (optional)
- Input. If set to
true
(the default), the localized string will be escaped to become consistent with usage inside a standard HTML setting (e.g., an HTML attribute or text). If this is used in conjunction withescape=true
, then the localized string will be escaped in a manner consistent with usage inside both HTML and Javascript (e.g., a mouseover command inside an HTML attribute.)
escape (optional)
- Input. If set to
true
, the localized string will be escaped to become consistent with usage inside a Javascript setting (e.g., a Javascript quoted constant). If not specified, the default isfalse
. If this is used in conjunction withencode=true
, then the localized string will be escaped in a manner consistent with usage inside both HTML and Javascript (e.g., a mouseover command inside an HTML attribute.)
evalall (optional)
- Input. If set to
true
(the default), then all environmental variables will be substituted in the localized string. For example, "hi there Variables.myname
" would be converted to "hi there Alyssa
", if there was a variable in calledmyname
with a value ofAlyssa
.
Ifevalall
is set tofalse
, then only variables described by includedxlat:argument
tags will be substituted.
Description
This tag looks up the value of a specified key in the
SystemLocaleString
table using either the specified locale, or the value in the session variablelocale
. If the locale is still not determined, a default value ofen_US
will be used.
After lookup, the string may optionally be prepared for usage in various contexts such as Javascript or HTML.Error Numbers
None.
Examples
This code looks up the key "mykey" in Canadian French and substitutes the result into an HTML attribute. The variable "myname" is made available for the localized text to substitute:
<xlat:lookup locale="fr_CA" varname="localvar" key="mykey" encode="true" escape="false" evalall="false"><xlat:argument name="myname" value='<%=ics.GetVar("mynamevar")%>'/></xlat:lookup> <A HREF="/mylink.html" ALT='<%=ics.GetVar("localvar")%>'>My link text</A>See Also
Home > Contents > Index > ![]()
Oracle JSP Tag Reference
Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.