Fix notifications (they were displayed always in English)

This commit is contained in:
Roman Drozd 2020-11-04 01:16:02 +01:00
parent 38645f5e3c
commit 3f378b7aae
2 changed files with 12 additions and 7 deletions

View file

@ -18,8 +18,8 @@ import * as notificationActions from './actions/notificationActions';
import * as transportActions from './actions/transportActions';
import Spotlights from './Spotlights';
import { permissions } from './permissions';
// import { updateIntl } from 'react-intl-redux';
import * as locales from './translations/locales';
import { createIntl } from 'react-intl';
let createTorrent;
@ -116,8 +116,6 @@ export default class RoomClient
static init(data)
{
store = data.store;
intl = data.intl;
}
constructor(
@ -259,7 +257,7 @@ export default class RoomClient
this._startDevicesListener();
this.setLocale(store.getState().intl.locale);
this.setLocale();
}
@ -502,10 +500,11 @@ export default class RoomClient
});
}
setLocale(locale)
setLocale(locale = null)
{
if (locale === null) locale = locales.detect();
const one = locales.loadOne(locale);
store.dispatch(intlActions.updateIntl({
@ -514,7 +513,13 @@ export default class RoomClient
list : locales.getList()
}));
document.documentElement.lang = one.locale[0].toUpperCase();
intl = createIntl({
locale : store.getState().intl.locale,
messages : store.getState().intl.messages
});
document.documentElement.lang = store.getState().intl.locale.toUpperCase();
}
login(roomId = this._roomId)

View file

@ -57,7 +57,7 @@ const logger = new Logger();
let roomClient;
RoomClient.init({ store, intl });
RoomClient.init({ store });
const theme = createMuiTheme(window.config.theme);