Warning: This is still a work in progress!
If you need something that can be used today, check out ember-i18n by James Alexander Rosen.
This library is intended to be minimal. It only provides a helper method for translating strings.
It uses the I18n-js library, which uses the same syntax and conventions that Rails does, but unlike i18n-js, this project is not intended to be used as a gem.
Pass the key of the translation.
If it is quoted, it will look that property up in the translations object and insert the current value of the property.
If a key is unquoted, it will be understood as a bound property, and evaluated in the current context, updating the value if it changes.
Interpolations are passed using the options object.
There are three ways in which namespaced translations can be expressed:
A) dot notation
B) passing a list of values
C) passing a key and a scope
In all cases, unquoted values passed to the list are bound to the current context.
Values passed using the options object, such as the scope or the interpolations, are not bound, even if they are unquoted. They are fetched from the current context.
If you want to bind the values in the options, append the suffix
'Binding'
to the property name:
In this last example, "salute"
is just a string, informal
is looked
up in the current context but is not bound, and nameBinding
is bound
to the current context.