A tag interface that serves as the root of a family of types used in static
internationalization. Using <code>GWT.create(<i>class</i>)</code> to
instantiate a type that directly extends or implements
<code>Localizable</code> invites locale-sensitive type substitution.
Locale-sensitive Type Substitution
If a type
Type
directly extends or implements
Localizable
(as opposed to
{@link com.google.gwt.i18n.client.Constants} or
{@link com.google.gwt.i18n.client.Messages}) and the following code is used
to create an object from
Type
as follows:
Type localized = (Type)GWT.create(Type.class);
then <code>localized</code> will be assigned an instance of a localized
subclass, selected based on the value of the <code>locale</code> client
property. The choice of subclass is determined by the following naming
pattern:
If locale is... |
The substitute class for Type is... |
unspecified |
Type itself, or Type_ if Type
is an interface |
x |
Class Type_x if it exists, otherwise treated as if
locale were unspecified |
x_Y |
Class Type_x_Y if it exists, otherwise treated as if
locale were x |
</table>
where in the table above <code>x</code> is a <a
href="http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt">ISO language
code</a> and <code>Y</code> is a two-letter <a
href="http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html">ISO
country code</a>.
Specifying Locale
The locale of a module is specified using the locale
client
property, which can be specified using either a meta tag or as part of the
query string in the host page's URL. If both are specified, the query string
takes precedence.
To specify the locale
client property using a meta tag in the
host HTML, use gwt:property
as follows:
<meta name="gwt:property" content="locale=x_Y">
For example, the following host HTML page sets the locale to "ja_JP":
{@gwt.include com/google/gwt/examples/i18n/ColorNameLookupExamplejaJP.html}
</p>
To specify the locale
client property using a query string,
specify a value for the name locale
. For example,
http://www.example.org/myapp.html?locale=fr_CA
</p>
For More Information
See the GWT Developer Guide for an introduction to internationalization.
@see com.google.gwt.i18n.client.Constants
@see com.google.gwt.i18n.client.ConstantsWithLookup
@see com.google.gwt.i18n.client.Messages
@see com.google.gwt.i18n.client.Dictionary
abstract class Localizable {
}
Subclasses
DateTimeFormatInfoImpl, LocalizableResource