[FIX] Language set by web client (#2488)
Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
0195506549
commit
b9a79a1724
|
@ -9,11 +9,11 @@ export const LANGUAGES = [
|
|||
file: require('./locales/en').default
|
||||
}, {
|
||||
label: '简体中文',
|
||||
value: 'zh-cn',
|
||||
value: 'zh-CN',
|
||||
file: require('./locales/zh-CN').default
|
||||
}, {
|
||||
label: '繁體中文',
|
||||
value: 'zh-tw',
|
||||
value: 'zh-TW',
|
||||
file: require('./locales/zh-TW').default
|
||||
}, {
|
||||
label: 'Deutsch',
|
||||
|
@ -21,7 +21,7 @@ export const LANGUAGES = [
|
|||
file: require('./locales/de').default
|
||||
}, {
|
||||
label: 'Español (ES)',
|
||||
value: 'es',
|
||||
value: 'es-ES',
|
||||
file: require('./locales/es-ES').default
|
||||
}, {
|
||||
label: 'Français',
|
||||
|
@ -29,11 +29,11 @@ export const LANGUAGES = [
|
|||
file: require('./locales/fr').default
|
||||
}, {
|
||||
label: 'Português (BR)',
|
||||
value: 'pt-br',
|
||||
value: 'pt-BR',
|
||||
file: require('./locales/pt-BR').default
|
||||
}, {
|
||||
label: 'Português (PT)',
|
||||
value: 'pt',
|
||||
value: 'pt-PT',
|
||||
file: require('./locales/pt-PT').default
|
||||
}, {
|
||||
label: 'Russian',
|
||||
|
|
|
@ -18,7 +18,7 @@ import { roomsRequest } from '../actions/rooms';
|
|||
import { toMomentLocale } from '../utils/moment';
|
||||
import RocketChat from '../lib/rocketchat';
|
||||
import log, { logEvent, events } from '../utils/log';
|
||||
import I18n from '../i18n';
|
||||
import I18n, { LANGUAGES } from '../i18n';
|
||||
import database from '../lib/database';
|
||||
import EventEmitter from '../utils/events';
|
||||
import { inviteLinksRequest } from '../actions/inviteLinks';
|
||||
|
@ -267,8 +267,9 @@ const handleLogout = function* handleLogout({ forcedByServer }) {
|
|||
|
||||
const handleSetUser = function* handleSetUser({ user }) {
|
||||
if (user && user.language) {
|
||||
I18n.locale = user.language;
|
||||
moment.locale(toMomentLocale(user.language));
|
||||
const locale = LANGUAGES.find(l => l.value.toLowerCase() === user.language)?.value || user.language;
|
||||
I18n.locale = locale;
|
||||
moment.locale(toMomentLocale(locale));
|
||||
}
|
||||
|
||||
if (user && user.status) {
|
||||
|
|
Loading…
Reference in New Issue