Merge pull request #2530 from mattermost/i18n-consolidation
Consolidating i18n into i18n.jsx
Этот коммит содержится в:
@@ -4,6 +4,11 @@
|
|||||||
const es = require('!!file?name=i18n/[name].[ext]!./es.json');
|
const es = require('!!file?name=i18n/[name].[ext]!./es.json');
|
||||||
const pt = require('!!file?name=i18n/[name].[ext]!./pt.json');
|
const pt = require('!!file?name=i18n/[name].[ext]!./pt.json');
|
||||||
|
|
||||||
|
import {addLocaleData} from 'react-intl';
|
||||||
|
import enLocaleData from 'react-intl/locale-data/en';
|
||||||
|
import esLocaleData from 'react-intl/locale-data/es';
|
||||||
|
import ptLocaleData from 'react-intl/locale-data/pt';
|
||||||
|
|
||||||
const languages = {
|
const languages = {
|
||||||
en: {
|
en: {
|
||||||
value: 'en',
|
value: 'en',
|
||||||
@@ -29,3 +34,24 @@ export function getLanguages() {
|
|||||||
export function getLanguageInfo(locale) {
|
export function getLanguageInfo(locale) {
|
||||||
return languages[locale];
|
return languages[locale];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function safariFix(callback) {
|
||||||
|
require.ensure([
|
||||||
|
'intl',
|
||||||
|
'intl/locale-data/jsonp/en.js',
|
||||||
|
'intl/locale-data/jsonp/es.js',
|
||||||
|
'intl/locale-data/jsonp/pt.js'
|
||||||
|
], (require) => {
|
||||||
|
require('intl');
|
||||||
|
require('intl/locale-data/jsonp/en.js');
|
||||||
|
require('intl/locale-data/jsonp/es.js');
|
||||||
|
require('intl/locale-data/jsonp/pt.js');
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function doAddLocaleData() {
|
||||||
|
addLocaleData(enLocaleData);
|
||||||
|
addLocaleData(esLocaleData);
|
||||||
|
addLocaleData(ptLocaleData);
|
||||||
|
}
|
||||||
|
|||||||
@@ -52,10 +52,7 @@ import OAuthToEmail from 'components/claim/components/oauth_to_email.jsx';
|
|||||||
import LDAPToEmail from 'components/claim/components/ldap_to_email.jsx';
|
import LDAPToEmail from 'components/claim/components/ldap_to_email.jsx';
|
||||||
import EmailToLDAP from 'components/claim/components/email_to_ldap.jsx';
|
import EmailToLDAP from 'components/claim/components/email_to_ldap.jsx';
|
||||||
|
|
||||||
import {addLocaleData} from 'react-intl';
|
import * as I18n from 'i18n/i18n.jsx';
|
||||||
import enLocaleData from 'react-intl/locale-data/en';
|
|
||||||
import esLocaleData from 'react-intl/locale-data/es';
|
|
||||||
import ptLocaleData from 'react-intl/locale-data/pt';
|
|
||||||
|
|
||||||
// This is for anything that needs to be done for ALL react components.
|
// This is for anything that needs to be done for ALL react components.
|
||||||
// This runs before we start to render anything.
|
// This runs before we start to render anything.
|
||||||
@@ -115,28 +112,14 @@ function preRenderSetup(callwhendone) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
function afterIntl() {
|
function afterIntl() {
|
||||||
addLocaleData(enLocaleData);
|
I18n.doAddLocaleData();
|
||||||
addLocaleData(esLocaleData);
|
|
||||||
addLocaleData(ptLocaleData);
|
|
||||||
|
|
||||||
$.when(d1, d2).done(callwhendone);
|
$.when(d1, d2).done(callwhendone);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (global.Intl) {
|
if (global.Intl) {
|
||||||
afterIntl();
|
afterIntl();
|
||||||
} else {
|
} else {
|
||||||
require.ensure([
|
I18n.safarifix(afterIntl);
|
||||||
'intl',
|
|
||||||
'intl/locale-data/jsonp/en.js',
|
|
||||||
'intl/locale-data/jsonp/es.js',
|
|
||||||
'intl/locale-data/jsonp/pt.js'
|
|
||||||
], (require) => {
|
|
||||||
require('intl');
|
|
||||||
require('intl/locale-data/jsonp/en.js');
|
|
||||||
require('intl/locale-data/jsonp/es.js');
|
|
||||||
require('intl/locale-data/jsonp/pt.js');
|
|
||||||
afterIntl();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user