Skip to content

Commit

Permalink
Expose i18nPromise through radio channel for access from views (#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonggrijp committed Jun 13, 2022
1 parent 08440c4 commit 1d71075
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions frontend/src/global/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { constant } from 'lodash';
import * as i18next from 'i18next';
import * as languageDetector from 'i18next-browser-languagedetector';

import * as english from '../i18n/en/translation.json';
import * as french from '../i18n/fr/translation.json';
import channel from '../i18n/radio';

const i18nPromise = new Promise(function(resolve, reject) {
i18next.use(
Expand All @@ -26,4 +28,6 @@ const i18nPromise = new Promise(function(resolve, reject) {
});
});

channel.reply('i18next', constant(i18nPromise));

export { i18nPromise, i18next };
5 changes: 5 additions & 0 deletions frontend/src/i18n/radio.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { channel } from 'backbone.radio';

export const channelName = 'readit-i18n';

export default channel(channelName);

0 comments on commit 1d71075

Please sign in to comment.