mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-03-22 19:05:56 -04:00
Add custom languages explicitly
This commit is contained in:
parent
429ad54349
commit
08a91f8521
2 changed files with 16 additions and 0 deletions
10
src/lib/custom-locales.json
Normal file
10
src/lib/custom-locales.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"yum": {
|
||||
"locale": "yum",
|
||||
"parentLocale": "en"
|
||||
},
|
||||
"cat": {
|
||||
"locale": "cat",
|
||||
"parentLocale": "en"
|
||||
}
|
||||
}
|
|
@ -2,11 +2,17 @@ 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…
Reference in a new issue