Fix /share and cleanup and reorganize frontend locale loading (#25240)

This commit is contained in:
Renaud Chaput 2023-06-02 15:00:27 +02:00 committed by GitHub
commit b0780cfeed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 152 additions and 638 deletions

View file

@ -1,8 +1,6 @@
import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import { IntlProvider } from 'react-intl';
import { Helmet } from 'react-helmet';
import { BrowserRouter, Route } from 'react-router-dom';
@ -16,11 +14,9 @@ import { connectUserStream } from 'mastodon/actions/streaming';
import ErrorBoundary from 'mastodon/components/error_boundary';
import UI from 'mastodon/features/ui';
import initialState, { title as siteTitle } from 'mastodon/initial_state';
import { getLocale, onProviderError } from 'mastodon/locales';
import { IntlProvider } from 'mastodon/locales';
import { store } from 'mastodon/store';
const { messages } = getLocale();
const title = process.env.NODE_ENV === 'production' ? siteTitle : `${siteTitle} (Dev)`;
const hydrateAction = hydrateStore(initialState);
@ -40,10 +36,6 @@ const createIdentityContext = state => ({
export default class Mastodon extends PureComponent {
static propTypes = {
locale: PropTypes.string.isRequired,
};
static childContextTypes = {
identity: PropTypes.shape({
signedIn: PropTypes.bool.isRequired,
@ -79,10 +71,8 @@ export default class Mastodon extends PureComponent {
}
render () {
const { locale } = this.props;
return (
<IntlProvider locale={locale} messages={messages} onError={onProviderError}>
<IntlProvider>
<ReduxProvider store={store}>
<ErrorBoundary>
<BrowserRouter>