-
Notifications
You must be signed in to change notification settings - Fork 27
How i18n Works
This page describes how friendlycode internationalizes requirejs-based code on the client side using Transifex.
This page does not describe how to internationalize user-generated content (e.g., Wikipedia).
It also doesn't describe how to internationalize content stored in a database on a server, though it can potentially inform such a scenario.
Give transifex.com your files to be localized, point your localizers at it, and get localized files back.
Transifex also supports all kinds of workflows for review/QA/etc if you want to use them.
Firefox already uses Transifex for the localization of its XML-based localization files.
requirejs is a module-loading infrastructure for JavaScript. It has a tiny i18n plugin that makes it easy to leverage the module-loading mechanism for the dynamic loading of localization strings. This is done by creating a module heirarchy called an i18n bundle.
Ideally, Transifex would support RequireJS i18n bundles the same way it currently supports gettext PO files, Java property files, and a variety of other formats. However, it doesn't currently, so until we (or someone else) pushes a change upstream to the transifex git repository, we convert i18n bundles to/from their closest Transifex-supported equivalent: Property List files.
For more information on converting an i18n bundle to a Property List file, see the Friendlycode documentation on adding a new i18n bundle module.
For more information on pulling the localized Property List files from Transifex and converting them to i18n files, see the Friendlycode documentation on trying out a localization (specifically, see the first numbered list item).
One of the nice things about the requirejs i18n bundle format is that it's ultimately just a bunch of JavaScript files structured in a certain way. Assuming we have a server that is able to take the current Transifex data and serve them out as a requireJS bundle in real-time, all we have to do to try out the in-progress localizations is point our app at a different URL for its i18n bundle data.
Ideally, this "live i18n bundle server" is something that Transifex itself would support—and we should propose an upstream change to do so—but for now we have a simple express server. The page at transifex-thimble.toolness.org uses this server to dynamically present localizers with their latest translations in-product. (Try viewing the source of that page; using the server to fetch localizations is just a simple change to the app's requirejs config.)