Closed zeppelin closed 9 years ago
Reflective issue: https://github.com/yahoo/react-intl/issues/46
Read thru the react-intl issue to understand why this is ambiguous in the context of the current API of .get()
I've been brain storming and I plan to isolate the intl-get calls to the locale module which is active (will fallback support to the defaultLocale
).
The locale modules will all have their own addMessage
and getMessage
. This will allow people to implement their own accessor logic. I'll start to implement this to see if it falls apart anywhere.. feel free to chime in if you see a hole in this.
Ember.get
. All locales now extend from a "class" instead of being POJOs.As of 2.5.x, ember g ember-intl-dot-notation
enables support for this w/o having to manually override internals.
C'est magnifique :+1:
Basically no Ember-related i18n library does allow dots in message keys, but I've found relying solely to
Ember.get
a bit counter-intuitive. Granted, the implementation is simpler, since it's a core Ember tool to fetch key paths and is working pretty well, but most of the i18n backeds use a key-value store like Redis. Therefore, when fetching the translations from the server, these messages must be un-flattened first to build up a hierarchical JS object structure, something Ember i18n libraries can deal with.Instead, just serializing a KV table into
is much more straightforward on the server then the currently required
While the filesize is somewhat bigger by default, it is negligible when gzipped. Also, the former speeds up message lookups as a byproduct.
As these two semantics are not mutually exclusive (exact key lookup first, then fall back to
Ember.get
), I see no disadvantage in supporting both.