mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-05-16 15:51:19 -04:00
Revert "Migrate to using a loader method"
This reverts commit 214430b0c4
.
This commit is contained in:
parent
214430b0c4
commit
ceec694b2a
24 changed files with 399 additions and 88 deletions
src/lib
|
@ -3,21 +3,22 @@ var ReactDOM = require('react-dom');
|
|||
var ReactIntl = require('./intl.jsx');
|
||||
var IntlProvider = ReactIntl.IntlProvider;
|
||||
|
||||
var render = function (jsx, element, messages) {
|
||||
var render = function (jsx, element) {
|
||||
// Get locale and messages from global namespace (see "init.js")
|
||||
var locale = window._locale || 'en';
|
||||
if (typeof messages[locale] === 'undefined') {
|
||||
if (typeof window._messages[locale] === 'undefined') {
|
||||
// Fall back on the split
|
||||
locale = locale.split('-')[0];
|
||||
}
|
||||
if (typeof messages[locale] === 'undefined') {
|
||||
if (typeof window._messages[locale] === 'undefined') {
|
||||
// Language appears to not be supported – fall back to 'en'
|
||||
locale = 'en';
|
||||
}
|
||||
var messages = window._messages[locale];
|
||||
|
||||
// Render component
|
||||
var component = ReactDOM.render(
|
||||
<IntlProvider locale={locale} messages={messages[locale]}>
|
||||
<IntlProvider locale={locale} messages={messages}>
|
||||
{jsx}
|
||||
</IntlProvider>,
|
||||
element
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue