KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > google > gwt > i18n > client > Localizable


1 /*
2  * Copyright 2006 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */

16
17 package com.google.gwt.i18n.client;
18
19 /**
20  * A tag interface that serves as the root of a family of types used in static
21  * internationalization. Using <code>GWT.create(<i>class</i>)</code> to
22  * instantiate a type that directly extends or implements
23  * <code>Localizable</code> invites locale-sensitive type substitution.
24  *
25  * <h3>Locale-sensitive Type Substitution</h3>
26  * If a type <code>Type</code> directly extends or implements
27  * <code>Localizable</code> (as opposed to
28  * {@link com.google.gwt.i18n.client.Constants} or
29  * {@link com.google.gwt.i18n.client.Messages}) and the following code is used
30  * to create an object from <code>Type</code> as follows:
31  *
32  * <pre class="code">Type localized = (Type)GWT.create(Type.class);</pre>
33  *
34  * then <code>localized</code> will be assigned an instance of a localized
35  * subclass, selected based on the value of the <code>locale</code> client
36  * property. The choice of subclass is determined by the following naming
37  * pattern:
38  *
39  * <table>
40  *
41  * <tr>
42  * <th align='left'>If <code>locale</code> is...&#160;&#160;&#160;&#160;</th>
43  * <th align='left'>The substitute class for <code>Type</code> is...</th>
44  * </tr>
45  *
46  * <tr>
47  * <td><i>unspecified</i></td>
48  * <td><code>Type</code> itself, or <code>Type_</code> if <code>Type</code>
49  * is an interface</td>
50  * </tr>
51  *
52  * <tr>
53  * <td><code>x</code></td>
54  * <td>Class <code>Type_x</code> if it exists, otherwise treated as if
55  * <code>locale</code> were <i>unspecified</i></td>
56  * </tr>
57  *
58  * <tr>
59  * <td><code>x_Y</code></td>
60  * <td>Class <code>Type_x_Y</code> if it exists, otherwise treated as if
61  * <code>locale</code> were <code>x</code></td>
62  * </tr>
63  *
64  * </table>
65  *
66  * where in the table above <code>x</code> is a <a
67  * HREF="http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt">ISO language
68  * code</a> and <code>Y</code> is a two-letter <a
69  * HREF="http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html">ISO
70  * country code</a>.
71  *
72  * <h3>Specifying Locale</h3>
73  * The locale of a module is specified using the <code>locale</code> client
74  * property, which can be specified using either a meta tag or as part of the
75  * query string in the host page's URL. If both are specified, the query string
76  * takes precedence.
77  *
78  * <p>
79  * To specify the <code>locale</code> client property using a meta tag in the
80  * host HTML, use <code>gwt:property</code> as follows:
81  *
82  * <pre>&lt;meta name="gwt:property" content="locale=x_Y"&gt;</pre>
83  *
84  * For example, the following host HTML page sets the locale to "ja_JP":
85  *
86  * {@gwt.include com/google/gwt/examples/i18n/ColorNameLookupExample_ja_JP.html}
87  * </p>
88  *
89  * <p>
90  * To specify the <code>locale</code> client property using a query string,
91  * specify a value for the name <code>locale</code>. For example,
92  *
93  * <pre>http://www.example.org/myapp.html?locale=fr_CA</pre>
94  *
95  * </p>
96  *
97  * <h3>For More Information</h3>
98  * See the GWT Developer Guide for an introduction to internationalization.
99  *
100  * @see com.google.gwt.i18n.client.Constants
101  * @see com.google.gwt.i18n.client.ConstantsWithLookup
102  * @see com.google.gwt.i18n.client.Messages
103  * @see com.google.gwt.i18n.client.Dictionary
104  */

105 public interface Localizable {
106 }
107
Popular Tags