I want to build some kind of a simple translation mechanism, i.e. keys should be replaced with values in templates. I looked into ember-i18n and saw that it registers its translation data in the Ember
namespace in an initializer, which can then be accessed from within a helper.
I actually don’t want to mess around with any vendor object, so I tried to inject in the initializer like
app.register("data:main", data, {instantiate: false, singleton: true})
app.inject("helper", "data", "data:main")
But there is no data
object in the helper available. In fact this
refers to the current context where the helper was called and not to any specific object.
So how would I inject dependencies into a helper? Or what would be a “clean” solution to this problem?