L20n/Examples

From MozillaWiki
< L20n
Revision as of 12:35, 25 January 2007 by AxelHecht (talk | contribs) (show the examples.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.

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.

It's implemented in java, for no reason but that I thought that antlr was a good tool. It's limited in functionality because antlr has some weeknesses, in particular in generating trees for hierarchical grammars. Like, file has entries, entries have key-values, values could be strings, arrays or hashes, strings can have params. It stopped working at the params level, so that is hacked right now. I didn't go into the detail of implementing expressions to be used for macros/functions, so there's no implementation for plurals.

app-toolkit demo

Tested on Firefox 2 with a Java 5 Update 10.

Plurals, DOM, Genders

This demo is a js-implemented dojo-based piece showing how plurals would work. In addition to that, it demos how one could map localized objects onto a DOM tree, which seems interesting to me.

It's using a hacked up fileformat much closer to json than what I intend to have in the end. The js-eval based approach didn't work for the app-toolkit composition demo, too. It does work for the plural forms nicely, though, that's why it's still there. And it does DOM.

DOM and plurals demo

Tested on Firefox 2. Uses __proto__, so don't expect this to work in IE.