I'm opening this as an issue so we can openly discuss how Ember-I18n will work in the future. As pointed out in #34, this project has a 1.x branch to support Ember 0.9.x and a 2.0 branch to support Ember 1.x.
This morning I decided I want to make some significant changes (improvements, I hope) to Ember-I18n. Because there will be breaking changes, my recommendation is that we work on them in a separate, long-lived branch and merge it into either 2.0 if that hasn't launched yet, or a new 3.0 version if it has.
The changes include:
Consolidation
Move pluralization rules into this repository. Everyone who's doing internationalization needs pluralization. Let's make it easy. We can expose two global functions that consumers can override if they want different pluralization behavior:
Ember.I18n.pluralForm
, which takes in a number and outputs one of [ "zero", "one", "two", "few", "many", "other" ]
. This defaults to delegating to the current locale's implementation.
Ember.I18n.fullTranslationKey
, which takes in a key ("foo.bar"
or "Save"
), an optional key context (useful for differentiating "Save (ticket)" from "Save (user)"), and one of the Strings from pluralForm
. By default, joins them, possibly with "."
.
Number Formatting
Add CLDR-compatible support for number formatting, including percentages and currencies. Add two helpers, formatNumber
and unboundFormatNumber
.
Time Formatting
Add support for date formatting. Add two helpers, formatDate
and unboundFormatDate
. Each requires only a Date. Locales define default formats. Support standard Date formatting strings as well as "ago", which renders strings like "3 minutes ago." If tagName="time"
is passed, render as <time datetime="2013-02-15T08:38">15 February</time>
.
Language Packs
Separate localization information into language packs. The default build will include all language packs. For those who don't support every language and want to cut down on bandwidth, add a grunt task and a Sprockets class that makes it easy to build custom Ember-I18n releases.
Oursourcing CLDR Data
Currently, the only CLDR rules that Ember-I18n consumes are the pluralization rules from CLDR.js, which are hard-coded. We can rely on node-cldr or node-closure to pull the rules from the CLDR database for us and compile the language packs.
/cc @ebryn, @rlivsey, @morten, @hjdivad, @pjmorse