mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-05-15 23:31:39 -04:00
Move custom-locales.js
to static/js/lib
So it can be loaded ahead of time and cached. Also remove the json since it's being loaded outside of react now, and put it into the js file directly.
This commit is contained in:
parent
b495beaeba
commit
4f541b8831
4 changed files with 10 additions and 24 deletions
src/lib
|
@ -2,17 +2,11 @@ var ReactDOM = require('react-dom');
|
|||
var ReactIntl = require('react-intl');
|
||||
var IntlProvider = ReactIntl.IntlProvider;
|
||||
|
||||
var customLanguages = require('./custom-locales.json');
|
||||
|
||||
var render = function (jsx, element) {
|
||||
// Get locale and messages from global namespace (see "init.js")
|
||||
var locale = window._locale;
|
||||
var messages = window._translations[locale];
|
||||
|
||||
if (customLanguages[locale] !== undefined) {
|
||||
ReactIntl.addLocaleData(customLanguages[locale]);
|
||||
}
|
||||
|
||||
// Render component
|
||||
var component = ReactDOM.render(
|
||||
<IntlProvider locale={locale} messages={messages}>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue