L20n/Examples: Difference between revisions
(move old samples off to wiki history, we have a fully functional plurals demo now in "Von allen Gedanken") |
|||
| (7 intermediate revisions by 4 users not shown) | |||
| Line 10: | Line 10: | ||
[http://people.mozilla.com/~axel/l20n/js-l20n/sample-04.html Plurals demo] | [http://people.mozilla.com/~axel/l20n/js-l20n/sample-04.html Plurals demo] | ||
=== Declension demo === | |||
This is a sample to demo the flexibility of l20n, going as far as to provide an extra value for one particular use. Mostly, because I don't know Finnish at all, so I couldn't really pick a better name. | |||
Please note that the complexity in this example is only affecting the Finnish localization, the English version remains unaffected. | |||
Thanks to Sini Ruohamaa for the request. | |||
[http://people.mozilla.com/~axel/l20n/js-l20n/sample-05.html Declensions demo] | |||
== Meet Pete == | == Meet Pete == | ||
| Line 22: | Line 31: | ||
=== Accesskeys demo === | === Accesskeys demo === | ||
This sample shows how to keep things together that belong together. In this case, that happens to be the value and the accesskey attributes for a HTML button. (Sadly, the accesskey doesn't work in fx2, tips?) | This sample shows how to keep things together that belong together. In this case, that happens to be the value and the accesskey attributes for a HTML button. (Sadly, the accesskey doesn't work in fx2, tips? [https://bugzilla.mozilla.org/show_bug.cgi?id=127411 Bug 127411]) | ||
[http://people.mozilla.com/~axel/l20n/js-l20n/sample-02.html accesskeys demo] | [http://people.mozilla.com/~axel/l20n/js-l20n/sample-02.html accesskeys demo] | ||
| Line 31: | Line 40: | ||
[http://people.mozilla.com/~axel/l20n/js-l20n/sample-03.html fallback demo] | [http://people.mozilla.com/~axel/l20n/js-l20n/sample-03.html fallback demo] | ||
==Reference links== | |||
* [http://blog.mozilla.org/l10n/2012/03/29/l20n-examples-for-localizers/ L20n examples for localizers] | |||
* [http://informationisart.com/3/ L20n demo with examples] | |||
<b>[https://wiki.mozilla.org/L20n Back to L20n home]</b> | |||
[[category:L20n]] | [[category:L20n]] | ||
Latest revision as of 14:49, 30 May 2012
As L20n is in its very early stages, the current examples are pretty rudimentary and tailored to show the feasibility of particular aspects. They're not all working on the same fileformat either, merely because that makes them easier to implement. Examples will be listed in chronological order, the further you go down, the bigger will be the differences compared to what's supposed to be the end result.
Right now, all demos are implemented in js, with varying use of the dojo toolkit, for no particular reason.
Von allen Gedanken
This revision added macros and expressions, and is the first time we can do demos for plurals again, which happens to be the only new sample this cycle, too. All Meet Pete examples work without modification.
Plurals demo
This demo shows how to create a macro and how to call into it to create strings depending on unknown quantities.
Declension demo
This is a sample to demo the flexibility of l20n, going as far as to provide an extra value for one particular use. Mostly, because I don't know Finnish at all, so I couldn't really pick a better name.
Please note that the complexity in this example is only affecting the Finnish localization, the English version remains unaffected.
Thanks to Sini Ruohamaa for the request.
Meet Pete
These demos are based on a pretty good grammar for the file formats, but don't support expressions yet, that's why there are no plural demos in this section. Meet Pete is the code name for this version.
App-Toolkit demo
This demo shows how to compose strings from two separate files, and how to make the resulting string look good. A typical example of a string from toolkit using the application name.
Tested on Firefox 2.
Accesskeys demo
This sample shows how to keep things together that belong together. In this case, that happens to be the value and the accesskey attributes for a HTML button. (Sadly, the accesskey doesn't work in fx2, tips? Bug 127411)
Language fallback
This sample shows how to implement one locale falling back to another. Using en-GB and en-US with en-GB falling back to en-US is merely because I don't speak any interesting languages, but the fallback path is totally programmatic and can be any locale to any other.