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

56 lines
1.7 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
2016-05-27 03:57:44 +08:00
function loadLib(libname) {
const successCallback = function() {
console.log(`successfully loaded lib - ${this}`);
2016-05-12 04:43:07 +08:00
};
2016-05-27 03:57:44 +08:00
const failCallback = function() {
console.log(`failed to load lib - ${this}`);
};
return Meteor.Loader.loadJs(`${window.location.origin}/client/lib/${libname}`, successCallback.bind(libname),
10000).fail(failCallback.bind(libname));
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');
2016-05-27 03:58:30 +08:00
loadLib('jquery.json-2.4.min.js');
2016-05-20 04:18:05 +08:00
loadLib('jquery.FSRTC.js');
loadLib('jquery.verto.js');
loadLib('jquery.jsonrpcclient.js');
loadLib('verto_extension.js');
loadLib('verto_extension_share.js');
2016-05-12 04:43:07 +08:00
render((
<IntlProvider locale={locale} messages={messages}>
{renderRoutes()}
</IntlProvider>
), document.getElementById('app'));
2016-01-13 04:15:16 +08:00
});