Skip to content

Commit d848e68

Browse files
committed
Update examples
1 parent aceef80 commit d848e68

20 files changed

+90
-2425
lines changed

CHANGES.md

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +0,0 @@
1-
1.0.0 beta 3
2-
============
3-
4-
* Core lib
5-
* Bug [886253](https://bugzil.la/886253) - l10n.reason may be undefined
6-
* Bug [886051](https://bugzil.la/886051) - Add a polyfill for String.startsWith in intl.js for WebKit
7-
* Bug [884201](https://bugzil.la/884201) - Macros should have strict arity rules
8-
* Bug [816887](https://bugzil.la/816887) - Macros should always return a String or a Literal
9-
* Bug [884228](https://bugzil.la/884228) - Referencing a macro (not calling it) should fail gracefully
10-
* Bug [884734](https://bugzil.la/884734) - Missing attributes should fail gracefully
11-
* Bug [883270](https://bugzil.la/883270) - Compiler should handle globals and ctxdata which are not strings
12-
* Bug [883664](https://bugzil.la/883664) - Missing members of strings, hashes, globals and variables
13-
* Bug [884229](https://bugzil.la/884229) - Detect cyclic references in indexes
14-
* Bug [886750](https://bugzil.la/886750) - Change how HashLiterals store content
15-
* Bug [803931](https://bugzil.la/803931) - Compiler is vulnerable to the billion laughs attack
16-
17-
* Infrastructure
18-
* Add attribute display to tools/compile
19-
* Bug [886082](https://bugzil.la/886082) - Add statistical testing to make perf
20-
* Bug [888192](https://bugzil.la/888192) - make perf underestimates the time of getting entites
21-
* Bug [885993](https://bugzil.la/885993) - Add .npmignore
22-
* Bug [883100](https://bugzil.la/883100) - Lint the code and create a make lint target
23-
* Bug [886824](https://bugzil.la/886824) - Introduce shell bindings target
24-
25-
(Full changelog: [1.0.0b2...1.0.0b3][])
26-
27-
[1.0.0b2...1.0.0b3]: https://github.com/l20n/l20n.js/compare/1.0.0b2...1.0.0b3

NOTICE

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,3 @@
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515

16-
The example files in examples/ use an AMD implementation provided by
17-
RequireJS, which is open source software licensed under the MIT License, and
18-
is copyright by The Dojo Foundation. The original software is availale from
19-
20-
http://requirejs.org/
21-

examples/README.md

Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,36 @@
1-
L20n Examples
2-
=============
1+
mozL10n Examples
2+
================
33

44
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.
79

10+
[main README]: ../README.md
811

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.
2912

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+
------------
3315

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.
3520

36-
Use this file if you want to experiment with L20n for your project and __immitate
37-
the production environment__.
3821

22+
concat.html
23+
-----------
3924

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.
4228

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.
4629

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+
-----------
4932

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.

examples/concat.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<html>
2+
<head>
3+
<meta charset="utf-8">
4+
<title data-l10n-id="title"></title>
5+
6+
<link rel="resource" type="application/l10n" href="locales/example.{{locale}}.json">
7+
<script defer="" src="../dist/runtime/l10n.js"></script>
8+
</head>
9+
10+
<body>
11+
<h1 data-l10n-id="hello"></h1>
12+
</body>
13+
</html>

examples/inline.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<html>
2+
<head>
3+
<meta charset="utf-8">
4+
<title data-l10n-id="title"></title>
5+
6+
<script defer="" src="../dist/runtime/l10n.js"></script>
7+
</head>
8+
9+
<body>
10+
<h1 data-l10n-id="hello"></h1>
11+
<script type="application/l10n" lang="fr">
12+
{
13+
"title": "Exemple de mozL10n",
14+
"hello": "Salut le monde !"
15+
}
16+
</script>
17+
<script type="application/l10n" lang="en-US">
18+
{
19+
"title": "mozL10n example",
20+
"hello": "Hello, world!"
21+
}
22+
</script>
23+
</body>
24+
</html>

examples/lib/LICENSE

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)