~ubuntu-branches/ubuntu/raring/maas/raring-updates

« back to all changes in this revision

Viewing changes to src/maasserver/static/jslibs/yui/3.4.1/docs/intl/index.html

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-07-03 17:42:37 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20120703174237-p8l0keuuznfg721k
Tags: 0.1+bzr709+dfsg-0ubuntu1
* New Upstream release
* debian/control:
  - Depends on python-celery, python-tempita, libjs-yui3-{full,min},
    libjs-raphael
* debian/maas.install:
  - Install apiclient, celeryconfig.py, maas-import-pxe-files, preseeds_v2.
  - Update to install various files from chroot, rather tha manually copy
    them from the source.
* debian/maas.links: symlink celeryconfig.py
* debian/maas.maas-celery.upstart: Add job.
* debian/rules:
  - Install celery upstart job.
  - Do not install jslibs as packages are now used.
  - Drop copying of maas_local_settings_sample.py as source now ships
    a maas_local_settings.py
* debian/patches:
  - 04-maas-http-fix.patch: Drop. Merged upstream.
  - 01-fix-database-settings.patch: Refreshed.
  - 99_enums_js.patch: Added until creation of enum.js / build process
    is fixed.
* debian/maas.postinst: Update bzr version to correctly handle upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE html>
2
 
<html lang="en">
3
 
<head>
4
 
    <meta charset="utf-8">
5
 
    <title>Internationalization</title>
6
 
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.4.0pr3/build/cssgrids/grids-min.css">
7
 
    <link rel="stylesheet" href="../assets/css/main.css">
8
 
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
9
 
    <script src="../../build/yui/yui-min.js"></script>
10
 
</head>
11
 
<body>
12
 
 
13
 
<div id="doc">
14
 
    <h1>Internationalization</h1>
15
 
 
16
 
    
17
 
        <a href="#toc" class="jump">Jump to Table of Contents</a>
18
 
    
19
 
 
20
 
    <div class="yui3-g">
21
 
        <div id="main" class="yui3-u">
22
 
            <div class="content"><div class="intro">
23
 
    <p>The Internationalization utility supports the management of localized resources such as strings and formatting patterns.</p>
24
 
</div>
25
 
 
26
 
<h2 id="scenarios">Usage Scenarios for the Internationalization Utility</h2>
27
 
 
28
 
<p>The YUI Internationalization utility supports externalization, that is,
29
 
separating data that needs to change for different languages or markets
30
 
from the code of a software product, so that the same code can be used
31
 
worldwide.</p>
32
 
 
33
 
<p>Depending on the kind of software you create with YUI, you will interact
34
 
with the Internationalization utility in different ways.</p>
35
 
 
36
 
<h3 id="monolingualApps">Monolingual Applications</h3>
37
 
 
38
 
<p>Many applications using YUI are not internationalized themselves; they
39
 
use one user interface language to target one market.
40
 
However, such applications still want language-sensitive modules that
41
 
they rely on to be internationalized and localized for their language.
42
 
For example, an application using Chinese to target Hong Kong wants dates
43
 
to be displayed in a Chinese format appropriate for Hong Kong, and so
44
 
relies on the DataType utility to provide such formats.</p>
45
 
 
46
 
<p>If the modules that such an application uses support the language of
47
 
the application, the problem is solved by simply
48
 
<a href="#prefLang">requesting preferred languages</a>. Otherwise, the
49
 
application may be able to fill the gap by
50
 
<a href="#appResources">providing resources to modules</a>.</p>
51
 
 
52
 
<h3 id="multilingualApps">Multilingual Applications</h3>
53
 
 
54
 
<p>An application that's intended for users in different markets or
55
 
using different languages has to be internationalized.<p>
56
 
 
57
 
<p>Primarily, this means developing its code in the form of
58
 
<a href="#intlModules">internationalized modules</a>, determining
59
 
the preferred user interface language(s),
60
 
<a href="#prefLang">requesting preferred languages</a>, and possibly
61
 
<a href="#appResources">providing resources to modules</a>.</p>
62
 
 
63
 
<p>Optionally, an application can provide a user interface element
64
 
that lets the user <a href="#switchingLangs">switch languages</a>
65
 
on the fly.</p>
66
 
 
67
 
<h3 id="intlModules">Internationalized Modules</h3>
68
 
 
69
 
<p>A module whose functionality is sensitive to different markets and
70
 
languages and that's intended for use by multilingual applications
71
 
or by different monolingual applications
72
 
has to be <a href="#modules">internationalized</a>.</p>
73
 
 
74
 
<h2 id="getting-started">Getting Started</h2>
75
 
 
76
 
<p>
77
 
To include the source files for Internationalization and its dependencies, first load
78
 
the YUI seed file if you haven't already loaded it.
79
 
</p>
80
 
 
81
 
<pre class="code prettyprint">&lt;script src=&quot;http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.4.1&#x2F;build&#x2F;yui&#x2F;yui-min.js&quot;&gt;&lt;&#x2F;script&gt;</pre>
82
 
 
83
 
 
84
 
<p>
85
 
Next, create a new YUI instance for your application and populate it with the
86
 
modules you need by specifying them as arguments to the <code>YUI().use()</code> method.
87
 
YUI will automatically load any dependencies required by the modules you
88
 
specify.
89
 
</p>
90
 
 
91
 
<pre class="code prettyprint">&#x2F;&#x2F; Create a new YUI instance and populate it with the required modules.
92
 
YUI().use(&#x27;intl&#x27;, function (Y) {
93
 
    &#x2F;&#x2F; Internationalization is available and ready for use. Add implementation
94
 
    &#x2F;&#x2F; code here.
95
 
});</pre>
96
 
 
97
 
 
98
 
<p>
99
 
For more information on creating YUI instances and on the
100
 
<a href="http://yuilibrary.com/yui/docs/api/classes/YUI.html#method_use"><code>use()</code> method</a>, see the
101
 
documentation for the <a href="../yui/index.html">YUI Global object</a>.
102
 
</p>
103
 
 
104
 
 
105
 
<h2 id="using">Using the Internationalization Utility</h2>
106
 
 
107
 
<h3 id="bcp47">Using BCP 47 Language Tags</h3>
108
 
 
109
 
<p>BCP 47 language tags are the identifiers for languages used on the internet.
110
 
BCP stands for IETF Best Current Practice, and BCP 47 is currently the combination
111
 
of <a href="http://tools.ietf.org/html/rfc5646">RFC 5646</a> and
112
 
<a href="http://tools.ietf.org/html/rfc4647">RFC 4647</a>.
113
 
These tags allow the description of languages in varying levels of detail, from
114
 
"Chinese" ("zh") to "Chinese written in traditional characters as used in Taiwan"
115
 
("zh-Hant-TW") and more. Typical components ("subtags") are ISO 639 language codes,
116
 
ISO 15924 script codes, and ISO 3166 country codes. Subtags are separated by
117
 
hyphens.</p>
118
 
 
119
 
<p>Here are the language tags for some popular languages:</p>
120
 
 
121
 
<table>
122
 
<tr><th>Language Tag<th>Description
123
 
<tr><td>zh-Hans-CN<td>Chinese, simplified characters, China
124
 
<tr><td>es<td>Spanish
125
 
<tr><td>en<td>English
126
 
<tr><td>hi-IN<td>Hindi, India
127
 
<tr><td>ar<td>Arabic
128
 
<tr><td>en-US<td>English, U.S.A.
129
 
<tr><td>id-ID<td>Indonesian, Indonesia
130
 
<tr><td>pt-BR<td>Portuguese, Brazil
131
 
<tr><td>ru-RU<td>Russian, Russia
132
 
<tr><td>fr<td>French
133
 
<tr><td>ja-JP<td>Japanese, Japan
134
 
<tr><td>es-MX<td>Spanish, Mexico
135
 
</table>
136
 
 
137
 
<p>BCP 47 also defines a "Lookup" algorithm, which is commonly used to determine
138
 
the best language for a user interface. Its input is an ordered list of
139
 
languages that the user prefers, and the list of languages that the software
140
 
supports. When looking for a language, the algorithm uses a fallback that
141
 
successively simplifies a language tag. For example, when looking for
142
 
a requested "zh-Hans-CN", it also checks whether "zh-Hans" or "zh" are
143
 
available.</p>
144
 
 
145
 
<p>The Internationalization utility provides the Lookup algorithm as the
146
 
<code>Intl.lookupBestLang</code> method, and the YUI loader uses it to determine
147
 
the best language based on an application's request and a module's language
148
 
support.</p>
149
 
 
150
 
<p>When requesting a language, it's generally a good idea to be specific and
151
 
include the country, because in some cases the differences between countries
152
 
are significant. For example, "3/5/10" means "March 5, 2010" in U.S. English,
153
 
but "3 May 2010" in British English.</p>
154
 
 
155
 
<p>When providing language support, on the other hand, you should also support
156
 
the less specific variant without country ("en", "es", "zh-Hans", etc.), so that
157
 
the fallback finds something when a request includes a country that you don't
158
 
support. Where the usage in different countries using the same language diverges
159
 
siginificantly, try to be neutral, e.g., by formatting dates in ISO notation
160
 
as 2010-03-05.</p>
161
 
 
162
 
<h3 id="applications">Internationalizing Applications</h3>
163
 
 
164
 
<h4 id="prefLang">Requesting Preferred Languages</h4>
165
 
 
166
 
<p>When creating a YUI instance, you can specify a list of preferred languages.</p>
167
 
 
168
 
<p>For a monolingual application, this list starts with the user interface
169
 
language of the application, but it may include other languages that
170
 
users are likely to understand, in case a module doesn't support the
171
 
preferred language. For example, an application in Arabic for Morocco might
172
 
specify French as a second choice since French is widely spoken in Morocco.</p>
173
 
 
174
 
<p>A multilingual application might maintain user language preferences as part of
175
 
the application, derive the preference list from the <code>Accept-Language</code>
176
 
header provided by the browser, or determine the list in some other fashion.</p>
177
 
 
178
 
<p>The preference list is specified as the <code>lang</code> property of the YUI
179
 
instance's config object. The YUI instance uses it to select the best available
180
 
language for each module and load the necessary resource bundles.</p>
181
 
 
182
 
<pre class="code prettyprint">&#x2F;&#x2F; Create new YUI instance, specify preferred languages,
183
 
&#x2F;&#x2F; and populate it with the required modules
184
 
YUI({lang:&quot;ar-MA,fr-FR&quot;}).use(&#x27;datatype-date&#x27;, function(Y) {
185
 
 
186
 
    &#x2F;&#x2F; DataType available, and hopefully localized into one of the preferred languages
187
 
 
188
 
});</pre>
189
 
 
190
 
 
191
 
<h4 id="appResources">Providing Resources to Modules</h4>
192
 
 
193
 
<p>In some cases, a module is internationalized, but doesn't have a resource
194
 
bundle for the desired language. It may however have specified the contents
195
 
of the resource bundle needed. In such a case, the application can register
196
 
a resource bundle for its language with the Internationalization utility and
197
 
set the language of that module.</p>
198
 
 
199
 
<p>For example, date formatting in the DataType utility has support for a
200
 
large number of languages built in, but Punjabi is not one of them. If
201
 
you need date formatting for Punjabi, you can provide a resource bundle for this
202
 
language (see the <a href="../datatype/index.html#addDateFormat">DataType</a>
203
 
documentation for information on the contents of the resource bundle):</p>
204
 
 
205
 
<pre class="code prettyprint">YUI().use(&quot;intl&quot;, &quot;datatype-date-format&quot;, function(Y) {
206
 
    &#x2F;&#x2F; provide data for Punjabi in India
207
 
    Y.Intl.add(&quot;datatype-date-format&quot;, &quot;pa-IN&quot;, {
208
 
            &quot;a&quot;:[&quot;ਐਤ.&quot;,&quot;ਸੋਮ.&quot;,&quot;ਮੰਗਲ.&quot;,&quot;ਬੁਧ.&quot;,&quot;ਵੀਰ.&quot;,&quot;ਸ਼ੁਕਰ.&quot;,&quot;ਸ਼ਨੀ.&quot;],
209
 
            &quot;A&quot;:[&quot;ਐਤਵਾਰ&quot;,&quot;ਸੋਮਵਾਰ&quot;,&quot;ਮੰਗਲਵਾਰ&quot;,&quot;ਬੁਧਵਾਰ&quot;,&quot;ਵੀਰਵਾਰ&quot;,&quot;ਸ਼ੁੱਕਰਵਾਰ&quot;,&quot;ਸ਼ਨੀਚਰਵਾਰ&quot;],
210
 
            &quot;b&quot;:[&quot;ਜਨਵਰੀ&quot;,&quot;ਫ਼ਰਵਰੀ&quot;,&quot;ਮਾਰਚ&quot;,&quot;ਅਪ੍ਰੈਲ&quot;,&quot;ਮਈ&quot;,&quot;ਜੂਨ&quot;,&quot;ਜੁਲਾਈ&quot;,&quot;ਅਗਸਤ&quot;,&quot;ਸਤੰਬਰ&quot;,&quot;ਅਕਤੂਬਰ&quot;,&quot;ਨਵੰਬਰ&quot;,&quot;ਦਸੰਬਰ&quot;],
211
 
            &quot;B&quot;:[&quot;ਜਨਵਰੀ&quot;,&quot;ਫ਼ਰਵਰੀ&quot;,&quot;ਮਾਰਚ&quot;,&quot;ਅਪ੍ਰੈਲ&quot;,&quot;ਮਈ&quot;,&quot;ਜੂਨ&quot;,&quot;ਜੁਲਾਈ&quot;,&quot;ਅਗਸਤ&quot;,&quot;ਸਤੰਬਰ&quot;,&quot;ਅਕਤੂਬਰ&quot;,&quot;ਨਵੰਬਰ&quot;,&quot;ਦਸੰਬਰ&quot;],
212
 
            &quot;c&quot;:&quot;%a, %Y %b %d %l:%M:%S %p %Z&quot;,
213
 
            &quot;p&quot;:[&quot;ਸਵੇਰੇ&quot;,&quot;ਸ਼ਾਮ&quot;],
214
 
            &quot;P&quot;:[&quot;ਸਵੇਰੇ&quot;,&quot;ਸ਼ਾਮ&quot;],
215
 
            &quot;x&quot;:&quot;%d&#x2F;%m&#x2F;%Y&quot;,
216
 
            &quot;X&quot;:&quot;%l:%M:%S %p&quot;
217
 
        });
218
 
    &#x2F;&#x2F; switch to Punjabi
219
 
    Y.Intl.setLang(&quot;datatype-date-format&quot;, &quot;pa-IN&quot;);
220
 
    &#x2F;&#x2F; now dates are formatted in Punjabi
221
 
    alert(Y.DataType.Date.format(new Date(), {format:&quot;%A %x %X&quot;}));
222
 
});</pre>
223
 
 
224
 
 
225
 
<h4 id="switchingLangs">Switching Languages</h4>
226
 
 
227
 
<p>Some applications let the user change the user interface language on the fly.
228
 
The Internationalization utility offers some low-level support for this:</p>
229
 
 
230
 
<ul>
231
 
    <li>Applications that want to make the languages offered reflect the actually
232
 
        available languages in one or more modules can obtain the necessary
233
 
        information from <code>Intl.getAvailableLangs</code>.
234
 
    <li>Once a new language has been selected, the application can load the
235
 
        required resource bundles and call <code>Intl.setLang</code> to
236
 
        switch localizable modules to the new language.
237
 
    <li>Modules that have language sensitive behavior, whether relying on
238
 
        their own resource bundles or on other modules', can listen to
239
 
        <code>intl:langChange</code> events to find out about language changes.
240
 
</ul>
241
 
 
242
 
<p>The <a href="../datatype/datatype-dateformat-lang.html">Formatting
243
 
Dates Using Language Resource Bundles</a> example shows how to use these interfaces.</p>
244
 
 
245
 
<h3 id="modules">Internationalizing Modules</h3>
246
 
 
247
 
<h4 id="externalizing">Externalizing Resources</h4>
248
 
 
249
 
<p>Externalization means moving all language-sensitive data into external data files,
250
 
also known as "resource bundles". Most of this data will be user interface strings
251
 
that have to be translated, but there may also be patterns strings, font names, or
252
 
other items. Resource bundles store this data as simple key-value pairs.</p>
253
 
 
254
 
<p>The first resource bundle you always have to provide for an internationalized module
255
 
is the root bundle, identified by the empty language tag "" and using the bundle name
256
 
<code>lang/<i>module</i></code>.
257
 
 
258
 
This is the bundle that will be used when an application requests a language that your module does
259
 
not support. Additional languages are identified by their BCP 47 language tags, and their resource
260
 
bundles use the names <code>lang/<i>module</i>_<i>language</i></code>.</p>
261
 
 
262
 
<p>If you've used resource bundles in Java or other internationalization libraries,
263
 
you may be familiar with the fallback mechanisms in their ResourceBundle classes.
264
 
These do not exist in YUI, so that the loader doesn't have to load multiple bundles.
265
 
As a consequence, each YUI resource bundle must provide the complete set of key-value
266
 
pairs that the module needs.</p>
267
 
 
268
 
<p>YUI currently supports two source formats for resource bundles: JSON-style
269
 
JavaScript source files, and Yahoo Resource Bundle format.</p>
270
 
 
271
 
<p>In JSON-style format, a resource bundle is a simple object whose properties
272
 
represent the bundle's key-value pairs. Source files use the JavaScript suffix
273
 
".js" and can contain comments, so that you can provide localizers with the
274
 
information they need for correct localization.
275
 
Here is a family of JSON files providing the same set of strings in English,
276
 
German, and simplified Chinese:</p>
277
 
 
278
 
<table>
279
 
<tr>
280
 
    <th></th>
281
 
    <th>English <span style="text-transform:none">(root)</span></th>
282
 
    <th>German<th>Simplified Chinese</th>
283
 
</tr>    
284
 
<tr>
285
 
    <th>File</th>
286
 
    <td>greetings.js</td>
287
 
    <td>greetings_de.js</td>
288
 
    <td>greetings_zh-Hans.js</td>
289
 
</tr>
290
 
<tr>
291
 
    <th>Contents</th>
292
 
    <td>
293
 
<pre class="code prettyprint">{
294
 
  HELLO: &quot;Hello!&quot;,
295
 
  GOODBYE: &quot;Goodbye!&quot;
296
 
}</pre>
297
 
 
298
 
    </td>
299
 
    <td>
300
 
<pre class="code prettyprint">{
301
 
  HELLO: &quot;Hallo!&quot;,
302
 
  GOODBYE: &quot;Tschüß!&quot;
303
 
}</pre>
304
 
 
305
 
    </td>
306
 
    <td>
307
 
<pre class="code prettyprint">{
308
 
  HELLO: &quot;你好!&quot;,
309
 
  GOODBYE: &quot;再见!&quot;
310
 
}</pre>
311
 
 
312
 
    </td>
313
 
</table>
314
 
 
315
 
<p>The <a href="#yrb">Yahoo Resource Bundles format</a> is a simple
316
 
text format for resource bundles that Yahoo open-sourced in 2009.
317
 
It uses the file name suffix ".pres".
318
 
Here are the same resource bundles as above in YRB format:</p>
319
 
 
320
 
<table>
321
 
<tr>
322
 
    <th></th>
323
 
    <th>English <span style="text-transform:none">(root)</span></th>
324
 
    <th>German</th>
325
 
    <th>Simplified Chinese</th>
326
 
</tr>
327
 
<tr>
328
 
    <th>File</th>
329
 
    <td>greetings.pres</td>
330
 
    <td>greetings_de.pres</td>
331
 
    <td>greetings_zh-Hans.pres</td>
332
 
</tr>
333
 
<tr>
334
 
    <th>Contents</th>
335
 
    <td>
336
 
<pre class="code prettyprint">HELLO = Hello!
337
 
GOODBYE = Goodbye!</pre>
338
 
 
339
 
    </td>
340
 
    <td>
341
 
<pre class="code prettyprint">HELLO = Hallo!
342
 
GOODBYE = Tschüß!</pre>
343
 
 
344
 
    </td>
345
 
    <td>
346
 
<pre class="code prettyprint">HELLO = 你好!
347
 
GOODBYE = 再见!</pre>
348
 
 
349
 
    </td>
350
 
</tr>
351
 
</table>
352
 
 
353
 
<h4 id="packaging">Packaging Resources</h4>
354
 
 
355
 
<p>The YUI loader expects resource bundles in a specific format. If you use the YUI Builder
356
 
to build your module, resource bundles in JSON or YRB format will be automatically
357
 
converted into the format expected by the loader. All you have to do is provide the source
358
 
files in the <code>src/<i>module</i>/lang/</code> directory, and specify the list of
359
 
available languages as the <code>component.lang</code> property of the module's
360
 
build.properties file:</p>
361
 
 
362
 
<pre class="code prettyprint">component.lang=de,zh-Hans</pre>
363
 
 
364
 
                
365
 
<p>If you use some other build process, you have to produce JavaScript files in the
366
 
following format:</p>
367
 
 
368
 
<pre class="code prettyprint">YUI.add(&quot;lang&#x2F;greetings_zh-Hans&quot;, function(Y) {
369
 
 
370
 
    Y.Intl.add(
371
 
 
372
 
        &quot;greetings&quot;,     &#x2F;&#x2F; associated module 
373
 
        &quot;zh-Hans&quot;,       &#x2F;&#x2F; BCP 47 language tag
374
 
 
375
 
        &#x2F;&#x2F; key-value pairs for this module and language 
376
 
        {
377
 
            HELLO: &quot;你好!&quot;,   
378
 
            GOODBYE: &quot;再见!&quot;
379
 
        }
380
 
    );
381
 
}, &quot;3.1.0&quot;);</pre>
382
 
 
383
 
 
384
 
<h4 id="specifying">Specifying Available Languages</h4>
385
 
 
386
 
<p>The YUI loader also needs to be told that your module uses resource bundles,
387
 
and for which languages it has resource bundles available. You provide this
388
 
information as the <code>lang</code> property of the module meta data:</p>
389
 
 
390
 
<pre class="code prettyprint">modules: {
391
 
    &quot;greetings&quot;: {
392
 
        lang: [&quot;de&quot;, &quot;zh-Hans&quot;]
393
 
    }
394
 
}</pre>
395
 
 
396
 
 
397
 
<h4 id="obtaining">Obtaining Resources</h4>
398
 
 
399
 
<p>To access its resources, a module simply calls <code>Intl.get</code> with its
400
 
module name. When instantiating YUI, the application will have requested its
401
 
user interface language, so <code>Intl.get</code> will return the appropriate
402
 
localized resource bundle.</p>
403
 
 
404
 
<pre class="code prettyprint">function Greetings() {
405
 
    &#x2F;&#x2F; Get localized strings in the current language
406
 
    this.resources = Y.Intl.get(&quot;greetings&quot;);
407
 
}
408
 
 
409
 
Greetings.prototype = {
410
 
 
411
 
    hello: function() {
412
 
        return this.resources.HELLO;
413
 
    },
414
 
 
415
 
    goodbye: function() {
416
 
        return this.resources.GOODBYE;
417
 
    }
418
 
}</pre>
419
 
 
420
 
 
421
 
<h3 id="yrb">Yahoo Resource Bundle Format</h3>
422
 
 
423
 
<p>The Yahoo Resource Bundle (YRB) format is a simple text format for
424
 
resource bundles. It's similar to Java properties files, but based
425
 
on UTF-8 and with additional heredoc support.</p>
426
 
 
427
 
<ul>
428
 
    <li>Files are encoded in UTF-8. The first line may be prefixed with a byte order mark (BOM).</li>
429
 
    <li>Lines whose first non-whitespace character is “#” are comment lines and are ignored.</li>
430
 
    <li>Lines that contain only whitespace characters and are not part of a heredoc string are ignored.</li>
431
 
    <li>Key-value definitions come in two forms:
432
 
        <ul>
433
 
            <li>The simple form has a key string, followed by “=”, followed by the value, all on one line.
434
 
                The tokens may or may not be surrounded by whitespace characters. Leading and trailing
435
 
                whitespace is trimmed from both key and value. The value cannot start with "<<<";
436
 
                for values starting with this character sequence, use the heredoc form.
437
 
            </li>
438
 
            <li>The heredoc form starts with a key string, followed by “=”, followed by “<<<”,
439
 
                followed by an identifier, all on one line.
440
 
                The tokens may or may not be surrounded by whitespace characters
441
 
                Leading and trailing whitespace is trimmed from both key and identifier.
442
 
                The heredoc form ends with a termination line that contains only the identifier,
443
 
                possibly followed by a semicolon.
444
 
                The lines between these two lines, except comment lines, form the heredoc string.
445
 
                The line break before the termination line is removed, all other line breaks are preserved.
446
 
            </li>
447
 
        </ul>
448
 
    </li>
449
 
    <li>Lines that are not comment lines, whitespace lines, or part of a key-value definition are illegal.</li>
450
 
    <li>The following escape sequences are recognized in values:
451
 
        <ul>
452
 
            <li>“\\” stands for “\”.</li>
453
 
            <li>“\n” stands for the newline character, U+000A.</li>
454
 
            <li>“\t” stands for the horizontal tab character, U+0009.</li>
455
 
            <li>“\ ” stands for the space character, U+0020. This is only needed if the value of a key-value
456
 
                pair starts or ends with a space character.</li>
457
 
            <li>“\#” stands for the number sign character, U+0023. This is only needed if a line within a
458
 
                heredoc string starts with this character.</li>
459
 
        </ul>
460
 
    </li>
461
 
    <li>A sequence of “\” followed by a character not listed above is illegal.
462
 
        A “\” immediately preceding the end of the file is illegal.</li>
463
 
    <li>Only the characters horizontal tab, U+0009, and space, U+0020, are considered whitespace.</li>
464
 
</ul>
465
 
</div>
466
 
        </div>
467
 
 
468
 
        <div id="sidebar" class="yui3-u">
469
 
            
470
 
                <div id="toc" class="sidebox">
471
 
                    <div class="hd">
472
 
                        <h2 class="no-toc">Table of Contents</h2>
473
 
                    </div>
474
 
 
475
 
                    <div class="bd">
476
 
                        <ul class="toc">
477
 
<li>
478
 
<a href="#scenarios">Usage Scenarios for the Internationalization Utility</a>
479
 
<ul class="toc">
480
 
<li>
481
 
<a href="#monolingualApps">Monolingual Applications</a>
482
 
</li>
483
 
<li>
484
 
<a href="#multilingualApps">Multilingual Applications</a>
485
 
</li>
486
 
<li>
487
 
<a href="#intlModules">Internationalized Modules</a>
488
 
</li>
489
 
</ul>
490
 
</li>
491
 
<li>
492
 
<a href="#getting-started">Getting Started</a>
493
 
</li>
494
 
<li>
495
 
<a href="#using">Using the Internationalization Utility</a>
496
 
<ul class="toc">
497
 
<li>
498
 
<a href="#bcp47">Using BCP 47 Language Tags</a>
499
 
</li>
500
 
<li>
501
 
<a href="#applications">Internationalizing Applications</a>
502
 
<ul class="toc">
503
 
<li>
504
 
<a href="#prefLang">Requesting Preferred Languages</a>
505
 
</li>
506
 
<li>
507
 
<a href="#appResources">Providing Resources to Modules</a>
508
 
</li>
509
 
<li>
510
 
<a href="#switchingLangs">Switching Languages</a>
511
 
</li>
512
 
</ul>
513
 
</li>
514
 
<li>
515
 
<a href="#modules">Internationalizing Modules</a>
516
 
<ul class="toc">
517
 
<li>
518
 
<a href="#externalizing">Externalizing Resources</a>
519
 
</li>
520
 
<li>
521
 
<a href="#packaging">Packaging Resources</a>
522
 
</li>
523
 
<li>
524
 
<a href="#specifying">Specifying Available Languages</a>
525
 
</li>
526
 
<li>
527
 
<a href="#obtaining">Obtaining Resources</a>
528
 
</li>
529
 
</ul>
530
 
</li>
531
 
<li>
532
 
<a href="#yrb">Yahoo Resource Bundle Format</a>
533
 
</li>
534
 
</ul>
535
 
</li>
536
 
</ul>
537
 
                    </div>
538
 
                </div>
539
 
            
540
 
 
541
 
            
542
 
                <div class="sidebox">
543
 
                    <div class="hd">
544
 
                        <h2 class="no-toc">Examples</h2>
545
 
                    </div>
546
 
 
547
 
                    <div class="bd">
548
 
                        <ul class="examples">
549
 
                            
550
 
                                
551
 
                                    <li data-description="How to create components which use language resource bundles.">
552
 
                                        <a href="intl-basic.html">Language Resource Bundles</a>
553
 
                                    </li>
554
 
                                
555
 
                            
556
 
                                
557
 
                            
558
 
                        </ul>
559
 
                    </div>
560
 
                </div>
561
 
            
562
 
 
563
 
            
564
 
                <div class="sidebox">
565
 
                    <div class="hd">
566
 
                        <h2 class="no-toc">Examples That Use This Component</h2>
567
 
                    </div>
568
 
 
569
 
                    <div class="bd">
570
 
                        <ul class="examples">
571
 
                            
572
 
                                
573
 
                            
574
 
                                
575
 
                                    <li data-description="Formatting dates into strings using pre-packaged language resource bundles.">
576
 
                                        <a href="../datatype/datatype-dateformat-lang.html">Formatting Dates Using Language Resource Bundles</a>
577
 
                                    </li>
578
 
                                
579
 
                            
580
 
                        </ul>
581
 
                    </div>
582
 
                </div>
583
 
            
584
 
        </div>
585
 
    </div>
586
 
</div>
587
 
 
588
 
<script src="../assets/vendor/prettify/prettify-min.js"></script>
589
 
<script>prettyPrint();</script>
590
 
 
591
 
</body>
592
 
</html>