Basic locale support

This commit is contained in:
Alex Gleason 2020-06-04 18:34:28 -05:00
parent 36447e4bf2
commit 6e1db9a013
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 129 additions and 6 deletions

View file

@ -14,8 +14,7 @@ import UI from '../features/ui';
// import Introduction from '../features/introduction';
import { fetchCustomEmojis } from '../actions/custom_emojis';
import { hydrateStore } from '../actions/store';
import { IntlProvider, addLocaleData } from 'react-intl';
import { getLocale } from '../locales';
import { IntlProvider } from 'react-intl';
import initialState from '../initial_state';
import ErrorBoundary from '../components/error_boundary';
import { fetchInstance } from 'soapbox/actions/instance';
@ -24,6 +23,7 @@ import { fetchMe } from 'soapbox/actions/me';
import PublicLayout from 'soapbox/features/public_layout';
import { getSettings } from 'soapbox/actions/settings';
import { generateThemeCss } from 'soapbox/utils/theme';
import messages from 'soapbox/locales/messages';
export const store = configureStore();
const hydrateAction = hydrateStore(initialState);
@ -73,9 +73,6 @@ class SoapboxMount extends React.PureComponent {
const { me, themeCss, locale } = this.props;
if (me === null) return null;
const { localeData, messages } = getLocale();
addLocaleData(localeData);
// Disabling introduction for launch
// const { showIntroduction } = this.props;
//
@ -91,7 +88,7 @@ class SoapboxMount extends React.PureComponent {
});
return (
<IntlProvider locale={locale} messages={messages}>
<IntlProvider locale={locale} messages={messages[locale]}>
<>
<Helmet>
<body className={bodyClass} />

View file

@ -0,0 +1,126 @@
export default {
'ar': require('./ar.json'),
'ast': require('./ast.json'),
'bg': require('./bg.json'),
'bn': require('./bn.json'),
'br': require('./br.json'),
'ca': require('./ca.json'),
'co': require('./co.json'),
'cs': require('./cs.json'),
'cy': require('./cy.json'),
'da': require('./da.json'),
'de': require('./de.json'),
'el': require('./el.json'),
'en': require('./en.json'),
'eo': require('./eo.json'),
'es-AR': require('./es-AR.json'),
'es': require('./es.json'),
'et': require('./et.json'),
'eu': require('./eu.json'),
'fa': require('./fa.json'),
'fi': require('./fi.json'),
'fr': require('./fr.json'),
'ga': require('./ga.json'),
'gl': require('./gl.json'),
'he': require('./he.json'),
'hi': require('./hi.json'),
'hr': require('./hr.json'),
'hu': require('./hu.json'),
'hy': require('./hy.json'),
'id': require('./id.json'),
'io': require('./io.json'),
'it': require('./it.json'),
'ja': require('./ja.json'),
'ka': require('./ka.json'),
'kk': require('./kk.json'),
'ko': require('./ko.json'),
'lt': require('./lt.json'),
'lv': require('./lv.json'),
'mk': require('./mk.json'),
'ms': require('./ms.json'),
'nl': require('./nl.json'),
'nn': require('./nn.json'),
'no': require('./no.json'),
'oc': require('./oc.json'),
'pl': require('./pl.json'),
'pt-BR': require('./pt-BR.json'),
'pt': require('./pt.json'),
'ro': require('./ro.json'),
'ru': require('./ru.json'),
'sk': require('./sk.json'),
'sl': require('./sl.json'),
'sq': require('./sq.json'),
'sr': require('./sr.json'),
'sr-Latn': require('./sr-Latn.json'),
'sv': require('./sv.json'),
'ta': require('./ta.json'),
'te': require('./te.json'),
'th': require('./th.json'),
'tr': require('./tr.json'),
'uk': require('./uk.json'),
'whitelist_ar': require('./whitelist_ar.json'),
'whitelist_ast': require('./whitelist_ast.json'),
'whitelist_bg': require('./whitelist_bg.json'),
'whitelist_bn': require('./whitelist_bn.json'),
'whitelist_br': require('./whitelist_br.json'),
'whitelist_ca': require('./whitelist_ca.json'),
'whitelist_co': require('./whitelist_co.json'),
'whitelist_cs': require('./whitelist_cs.json'),
'whitelist_cy': require('./whitelist_cy.json'),
'whitelist_da': require('./whitelist_da.json'),
'whitelist_de': require('./whitelist_de.json'),
'whitelist_el': require('./whitelist_el.json'),
'whitelist_en': require('./whitelist_en.json'),
'whitelist_eo': require('./whitelist_eo.json'),
'whitelist_es-AR': require('./whitelist_es-AR.json'),
'whitelist_es': require('./whitelist_es.json'),
'whitelist_et': require('./whitelist_et.json'),
'whitelist_eu': require('./whitelist_eu.json'),
'whitelist_fa': require('./whitelist_fa.json'),
'whitelist_fi': require('./whitelist_fi.json'),
'whitelist_fr': require('./whitelist_fr.json'),
'whitelist_ga': require('./whitelist_ga.json'),
'whitelist_gl': require('./whitelist_gl.json'),
'whitelist_he': require('./whitelist_he.json'),
'whitelist_hi': require('./whitelist_hi.json'),
'whitelist_hr': require('./whitelist_hr.json'),
'whitelist_hu': require('./whitelist_hu.json'),
'whitelist_hy': require('./whitelist_hy.json'),
'whitelist_id': require('./whitelist_id.json'),
'whitelist_io': require('./whitelist_io.json'),
'whitelist_it': require('./whitelist_it.json'),
'whitelist_ja': require('./whitelist_ja.json'),
'whitelist_ka': require('./whitelist_ka.json'),
'whitelist_kk': require('./whitelist_kk.json'),
'whitelist_ko': require('./whitelist_ko.json'),
'whitelist_lt': require('./whitelist_lt.json'),
'whitelist_lv': require('./whitelist_lv.json'),
'whitelist_mk': require('./whitelist_mk.json'),
'whitelist_ms': require('./whitelist_ms.json'),
'whitelist_nl': require('./whitelist_nl.json'),
'whitelist_nn': require('./whitelist_nn.json'),
'whitelist_no': require('./whitelist_no.json'),
'whitelist_oc': require('./whitelist_oc.json'),
'whitelist_pl': require('./whitelist_pl.json'),
'whitelist_pt-BR': require('./whitelist_pt-BR.json'),
'whitelist_pt': require('./whitelist_pt.json'),
'whitelist_ro': require('./whitelist_ro.json'),
'whitelist_ru': require('./whitelist_ru.json'),
'whitelist_sk': require('./whitelist_sk.json'),
'whitelist_sl': require('./whitelist_sl.json'),
'whitelist_sq': require('./whitelist_sq.json'),
'whitelist_sr': require('./whitelist_sr.json'),
'whitelist_sr-Latn': require('./whitelist_sr-Latn.json'),
'whitelist_sv': require('./whitelist_sv.json'),
'whitelist_ta': require('./whitelist_ta.json'),
'whitelist_te': require('./whitelist_te.json'),
'whitelist_th': require('./whitelist_th.json'),
'whitelist_tr': require('./whitelist_tr.json'),
'whitelist_uk': require('./whitelist_uk.json'),
'whitelist_zh-CN': require('./whitelist_zh-CN.json'),
'whitelist_zh-HK': require('./whitelist_zh-HK.json'),
'whitelist_zh-TW': require('./whitelist_zh-TW.json'),
'zh-CN': require('./zh-CN.json'),
'zh-HK': require('./zh-HK.json'),
'zh-TW': require('./zh-TW.json'),
};