Technology Evaluation - Internationalising and Localising UI strings
To support the work on the dev PMT, Steve Githens asked if we could add the ability to internationalise messages to gpii-handlebars. I first looked into the support within handlebars itself, they suggest making a helper that accepts some kind of message key.
Writing a helper is not difficult, but we need to look around at what might power this helper, i.e. what would actually be taking a locale, a message string, and variables, and turning that into internationalised text to be displayed.
We need an approach that:
- Lets us provide locale-specific wording in our user interfaces.
- Supports cleanly interpolating variables.
- Works in supported browsers (for client-side rendering).
- Works in supported Node versions (for server-side rendering).
- Is open source with a compatible license.
- Does not introduce an inordinate amount of complexity, for example, by:
- Requiring us to convert node libraries using browserify
- Requiring loading many and/or very large libraries.
- Forcing us to adopt large parts of another framework just to handle this specific problem.
First, we have the i18n support build into Infusion itself. We should consider this as one starting point, but also look at what else is out there. With that in mind, I reviewed every library mentioned in this excellent overview on StackOverflow (including a few mentioned within those projects).
Here is a summary table of all candidates:
|Library||Meets Requirements||Node Support||Browser Support||Community||Complexity||Licence|
|browser-i18n||Possibly (when paired with node-i18n or node-i18n2)||no||yes||Long-lived project with very very infrequent updates (years between commits).||Low (single library).||MIT|
|counterpart||Yes||yes||yes||Modest but consistent activity over the years. Primarily a single maintainer.||Low (single library).||MIT|
|ECMAScript i18n API||No (no support for strings)||yes, in later versions.||yes, in most modern browsers.||It’s a standard, so the community is the ECMAScript community.||Very low (built into the language)||?|
|i10n.js||No (no node support)||no||yes||Seems like a more or less single maintainer, and the project seems dead at this point. Even their docs site is a 404.||Low (single library).||MIT|
|i18n-node-2||Possibly (when paired with browser-i18n)||yes||no||Limited activity, year-long gap between recent commits.||Low (single library).||MIT|
|i18n-node||Possibly (when paired with browser-i18n)||yes||no||Consistent, but spiky commits.||Low (single library).||MIT|
|i18next||Yes||yes||yes||By far the healthiest-seeming community with huge momentum, especially recently. Good industry adoption, but limited core committers.||Low (single library).||MIT|
|Intl.js||Yes||yes||yes||Seems to have less recent activity, but otherwise healthy.||Low (single library).||MIT|
|jQuery globalize||No (no node support)||no||yes||Massive and vibrant.||Low (only requires jQuery).||MIT|
|jQuery Localisation Plugin||No (no node support)||no||yes||Very low activity, and none since 2012. Seems dead.||Low (only requires jQuery).||GPL and MIT|
|jQuery.i18Now||No (no node support)||no||yes||No activity since late 2014.||Low (only requires jQuery).||MIT|
|js-lingui||No (too complex)||maybe||yes||New project, very active. Seems to be mainly a single maintainer.||High (claims neutrality, but heavily skewed towards React)||MIT|
|l10ns||No (too complex and not a strong enough community)||yes||yes||Seems like mainly a single maintainer, and not much recent activity.||Moderate. They have their own templating and lookup languages.||Apache 2.0|
|l20n.js||No (no node support)||no||yes||Seems healthy and fairly active. They look like they’re steadily gaining momentum.||Low (single library).||Apache 2.0|
|moment.js||No (only dates)||yes||yes||Steady flow of commits and releases, modest group of core committers.||Low (single library).||MIT|
|numbro.js||No (only numbers)||yes||yes||Slower, but steady flow of commits and releases.||Low (single library).||MIT|
|requirejs-i18n||No (too complex)||yes||yes||Massive effort, less activity recently.||High (requires using a different module loader).||MIT|
|YUI internationalisation||No (no node support)||no||yes||No activity since late 2014.||Moderate to high, requires using YUI.||BSD|
After the initial review, the final candidates are:
Once we have discussed the list of candidates, each of the candidates should be reviewed in more depth.
Once there is a detailed breakdown and we have discussed, the conclusions will appear here.