bigbluebutton-Github/bigbluebutton-html5/client/main.jsx

45 lines
1.4 KiB
React
Raw Normal View History

import React from 'react';
2016-04-29 03:02:51 +08:00
import { Meteor } from 'meteor/meteor';
import { render } from 'react-dom';
import { renderRoutes } from '../imports/startup/client/routes.js';
import { IntlProvider, addLocaleData } from 'react-intl';
import Locales from '../imports/locales';
import en from 'react-intl/locale-data/en';
import es from 'react-intl/locale-data/es';
import pt from 'react-intl/locale-data/pt';
/* TODO: Add this dynamically */
addLocaleData([...en, ...es, ...pt]);
// Safari sends us en-us instead of en-US
2016-05-06 06:30:57 +08:00
let locale = navigator.language.split('-');
locale = locale[1] ? `${locale[0]}-${locale[1].toUpperCase()}` : navigator.language;
/* TODO: We should load the en first then merge with the en-US
(eg: load country translation then region) */
let messages = Locales[locale] || Locales['en'] || {};
2016-05-12 04:43:07 +08:00
// Helper to load javascript libraries from the BBB server
function loadLib(libname, successCallback) {
const retryMessageCallback = function (param) {
return console.log('Failed to load library', param);
};
2016-05-13 00:10:43 +08:00
return Meteor.Loader.loadJs(`${window.location.origin}/client/lib/${libname}`, successCallback,
10000).fail(retryMessageCallback);
2016-05-12 04:43:07 +08:00
};
2016-01-13 04:15:16 +08:00
Meteor.startup(() => {
2016-05-12 04:43:07 +08:00
loadLib('sip.js');
loadLib('bbb_webrtc_bridge_sip.js');
loadLib('bbblogger.js');
render((
<IntlProvider locale={locale} messages={messages}>
{renderRoutes()}
</IntlProvider>
), document.getElementById('app'));
2016-01-13 04:15:16 +08:00
});