2015-10-15 23:11:09 -04:00
|
|
|
var ReactDOM = require('react-dom');
|
|
|
|
var ReactIntl = require('react-intl');
|
|
|
|
var IntlProvider = ReactIntl.IntlProvider;
|
|
|
|
|
2015-10-16 15:10:17 -04:00
|
|
|
var render = function (jsx, element) {
|
2015-10-15 23:11:09 -04:00
|
|
|
// Get locale and messages from global namespace (see "init.js")
|
|
|
|
var locale = window._locale;
|
|
|
|
var messages = window._translations[locale];
|
|
|
|
|
|
|
|
// Render component
|
|
|
|
var component = ReactDOM.render(
|
|
|
|
<IntlProvider locale={locale} messages={messages}>
|
|
|
|
{jsx}
|
|
|
|
</IntlProvider>,
|
|
|
|
element
|
|
|
|
);
|
|
|
|
|
2015-11-03 10:49:32 -05:00
|
|
|
// Provide list of rendered components
|
|
|
|
window._renderedComponents = window._renderedComponents || [];
|
|
|
|
window._renderedComponents.push(component);
|
2015-10-15 23:11:09 -04:00
|
|
|
};
|
2015-10-16 15:10:17 -04:00
|
|
|
|
|
|
|
module.exports = render;
|