Skip to content

Commit 4a89a08

Browse files
committed
Override i18n.t instead of helper
1 parent c458751 commit 4a89a08

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

addon/instance-initializers/ember-osf.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,24 @@ Automatically expose translations for addon in a way that can be merged in with
44
*/
55
import Ember from 'ember';
66
import en from 'ember-osf/locales/en/translations';
7-
import tHelper from 'ember-i18n/helper';
8-
97

108
export function initialize(appInstance) {
11-
tHelper.reopen({
9+
const i18n = appInstance.lookup('service:i18n');
10+
i18n.reopen({
1211
theme: Ember.inject.service(),
13-
compute(_, params) {
14-
let translations = this.get('i18n._locale.translations');
12+
t(_, data) {
13+
let translations = this.get('_locale.translations');
1514
let preprintWord = this.get('theme.provider.preprintWord') || 'preprint';
16-
params = params || {};
17-
params.preprintWords = {
15+
data = data || {};
16+
data.preprintWords = {
1817
preprint: translations[`preprintWords.${preprintWord}.preprint`],
1918
preprints: translations[`preprintWords.${preprintWord}.preprints`],
2019
Preprint: translations[`preprintWords.${preprintWord}.Preprint`],
2120
Preprints: translations[`preprintWords.${preprintWord}.Preprints`]
2221
};
23-
return this._super(_, params);
22+
return this._super(_, data);
2423
}
2524
});
26-
const i18n = appInstance.lookup('service:i18n');
2725
i18n.addTranslations('en', en);
2826
}
2927

0 commit comments

Comments
 (0)