|
1 |
| -L20n Examples |
2 |
| -============= |
| 1 | +mozL10n Examples |
| 2 | +================ |
3 | 3 |
|
4 | 4 | This directory contains example HTML files which are ready to be used in the
|
5 |
| -browser. All files must be accessed on `http://localhost` for |
6 |
| -`XMLHttpRequest`s to work properly. |
| 5 | +browser. It runs a built version of mozL10n which can be included in an HTML |
| 6 | +page with a single `<script>` element. In order to make it work, you'll need |
| 7 | +to run `grunt build` first. See the [main README][] in the root of the repo |
| 8 | +for more information. |
7 | 9 |
|
| 10 | +[main README]: ../README.md |
8 | 11 |
|
9 |
| -multilingual-dev.html |
10 |
| ---------------------- |
11 |
| - |
12 |
| -This files uses a localization manifest which tells L20n to run in the |
13 |
| -multilingual mode, i.e. with language negotiation and language fallback |
14 |
| -enabled. |
15 |
| - |
16 |
| -It also makes use of an AMD module loader (RequireJS) to dynamically |
17 |
| -and asynchronously load L20n source files, so that no build step is necessary. |
18 |
| - |
19 |
| -Use this file if you want to __hack on L20n's codebase__ and immediately see your |
20 |
| -edits when you refresh the browser. |
21 |
| - |
22 |
| - |
23 |
| -multilingual-prod.html |
24 |
| ----------------------- |
25 |
| - |
26 |
| -This files uses a localization manifest which tells L20n to run in the |
27 |
| -multilingual mode, i.e. with language negotiation and language fallback |
28 |
| -enabled. |
29 | 12 |
|
30 |
| -It runs a built version of L20n which can be included in an HTML page with |
31 |
| -a single `<script>` element. In order to make it work, you'll need to run |
32 |
| -`make build` first. See the [main README][] for more information. |
| 13 | +basic.html |
| 14 | +------------ |
33 | 15 |
|
34 |
| -[main README]: ../README.md |
| 16 | +This is the basic example of mozL10n in action, with no I/O optimizations. The |
| 17 | +localization resources are defined in `locales/example.ini`. mozL10n first |
| 18 | +downloads the ini file and then proceeds to fetch the properties files relevant |
| 19 | +to the user's preferred language. |
35 | 20 |
|
36 |
| -Use this file if you want to experiment with L20n for your project and __immitate |
37 |
| -the production environment__. |
38 | 21 |
|
| 22 | +concat.html |
| 23 | +----------- |
39 | 24 |
|
40 |
| -monolingual-dev.html |
41 |
| ---------------------- |
| 25 | +In this example, the localization resources have been parsed and concatenated |
| 26 | +into a single JSON file for each language. This allows to avoid the I/O |
| 27 | +related to the ini file. |
42 | 28 |
|
43 |
| -This file runs L20n in the monolignual mode, with no manifest, no language |
44 |
| -negotiation and no language fallback. There is only one locale available, bu |
45 |
| -however the localization still happens at runtime, on the client side. |
46 | 29 |
|
47 |
| -It also makes use of an AMD module loader (RequireJS) to dynamically |
48 |
| -and asynchronously load L20n source files, so that no build step is necessary. |
| 30 | +inline.html |
| 31 | +----------- |
49 | 32 |
|
50 |
| -Use this file for __quick experiments__ which don't involve language fallback, for |
51 |
| -presentations, or for testing server-side or build-time optimizations. |
| 33 | +In this example, mozL10n is further optimized by embedding localization resources |
| 34 | +into the HTML. No additional I/O is required, but the size of the HTML |
| 35 | +increases linearly to the number of supported languages, so be careful when |
| 36 | +using this approach. |
0 commit comments