amiel/ember-data-url-templates

Can I inject i18n in my adapters?

jobsboris27 opened this issue · 1 comments

I want to inject i18n in adapter for changing my namespace.

namespace: `someApi/someUrl/${this.get('i18n.locale')}`

amiel commented

Yep, you would want to do something like this:

urlTemplate: 'http://example.com/someApi/someUrl/{locale}/whatever',
i18n: inject.service(),

urlSegments: {
  locale() {
    return this.get('i18n.locale');
  },
}