l10n.js Content Kit
JavaScript library that enables localization through the native JavaScript method intended for it.
Technology level: well established.
For any issues, submit issues against https://github.com/CodingFree/l10n-content-kit.
Versioning information
Current as of June 2015.
This content kit is published under the Mozilla Public License, version 2.0.
What should the presenter have?
- What hardware and software will the presenter need?
- Any browser, any version.
- Any plain-text editor.
- Any JavaScript console.
- What knowledge and background will the presenter most likely need?
- JavaScript.
- HTML.
- Some i18n/l10n basics.
- Some ISO-639-1 codes for locales.
What should the audience have?
- What hardware and software will the audience need?
- Nothing, but they may need a plain-text editor and a browser If they want to try it.
- What knowledge and background is the audience recommended to have? For beginner level kits, please include even basics like understanding how to write a simple web page or understanding how to use an editor.
- How to write a simple web page.
- Some basic Javascript may be desirable.
Learning objectives
After you present or teach this content kit, your audience will know how to:
- Localize your Web Applications
Link to materials
Project resources overview
- Source code: link
- Live demo: link
- Issue tracker/feedback: link
Supporting docs/references
- Mozilla Hacks: link
- Fabien Cazenave's l10n.js: link
- l20n - Mozilla Wiki: link
Presentation setup
Demo setup
- Link to demos
- Demo script:
- Just run the demo, it is self-explanatory.
- It has an app manifest, so it could be installed on a Firefox OS device.
- Troubleshooting:
- If you try to use document.webL10n, it will be undefined. We are using a prefixed object: navigator.mozL10n.
- You can use navigator.mozL10n.language.code to change the language manually.
- But also, you can access about:config and edit intl.accept_languages to something like 'es,en-us,es-es,es,en'.
Active learning
Clone and edit the example.
Frequently asked questions (FAQs)
- What is l20n?
- The Mozilla l20n project aims to supersede l10n formats like Gettext, mostly by allowing C-style macros in l10n resources. The l20n project brings a generic solution (expressions) to handle complex grammatical rules.
- What is the 'LOL' format?
- The 'LOL' format is specific to the l20n project. The 'LOL' format is a mix of C-style comments and logical expressions, JSON-like values and DTD-like entities.
- Why not 'LOL' format in l10n?
- By design, LOL entities are not nestable. This gets in the developer’s way when dealing with more complex structures than just HTML elements.