File tree Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -2,15 +2,21 @@ import data from '../../i18n/oceans.json';
22import MessageFormat from 'messageformat'
33
44let messages ;
5- export const init = ( i18n = { } ) => {
5+
6+ const initI18n = ( i18n = { } ) => {
67 // For now, use English pluralization rules.
78 const mf = new MessageFormat ( 'en' ) ;
89 messages = { ...mf . compile ( data ) , ...i18n } ;
910} ;
1011
11- export const t = ( key , options ) => {
12+ const t = ( key , options ) => {
1213 if ( ! messages ) {
1314 throw "I18n must be initialized before calling t" ;
1415 }
1516 return messages [ key ] ( options ) ;
1617} ;
18+
19+ export default {
20+ initI18n,
21+ t
22+ } ;
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import {setInitialState, setSetStateCallback} from './state';
77import { render as renderCanvas } from './renderer' ;
88import modeHelpers from './modeHelpers' ;
99import soundLibrary from './models/soundLibrary' ;
10- import * as I18n from './i18n' ;
10+ import I18n from './i18n' ;
1111
1212//
1313// Required in options:
@@ -27,7 +27,7 @@ export const initAll = function(options) {
2727
2828 soundLibrary . loadSounds ( ) ;
2929
30- I18n . init ( options . i18n ) ;
30+ I18n . initI18n ( options . i18n ) ;
3131
3232 // Set initial state for UI elements.
3333 setInitialState ( {
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import {ClassType, AppMode} from '../constants';
44import SimpleTrainer from '../../utils/SimpleTrainer' ;
55import SVMTrainer from '../../utils/SVMTrainer' ;
66import { generateOcean } from '../../utils/generateOcean' ;
7- import * as I18n from '../i18n' ;
7+ import I18n from '../i18n' ;
88
99const init = ( ) => {
1010 const state = getState ( ) ;
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ import {
3131 faInfo ,
3232 faTrash
3333} from '@fortawesome/free-solid-svg-icons' ;
34- import * as I18n from './i18n' ;
34+ import I18n from './i18n' ;
3535
3636const styles = {
3737 body : {
You can’t perform that action at this time.
0 commit comments