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
parent 5fae2de454
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

@ -2,8 +2,6 @@ import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import { createPortal } from 'react-dom';
import { IntlProvider } from 'react-intl';
import { fromJS } from 'immutable';
import { ImmutableHashtag as Hashtag } from 'mastodon/components/hashtag';
@ -14,17 +12,14 @@ import Audio from 'mastodon/features/audio';
import Card from 'mastodon/features/status/components/card';
import MediaModal from 'mastodon/features/ui/components/media_modal';
import Video from 'mastodon/features/video';
import { getLocale, onProviderError } from 'mastodon/locales';
import { IntlProvider } from 'mastodon/locales';
import { getScrollbarWidth } from 'mastodon/utils/scrollbar';
const { messages } = getLocale();
const MEDIA_COMPONENTS = { MediaGallery, Video, Card, Poll, Hashtag, Audio };
export default class MediaContainer extends PureComponent {
static propTypes = {
locale: PropTypes.string.isRequired,
components: PropTypes.object.isRequired,
};
@ -73,7 +68,7 @@ export default class MediaContainer extends PureComponent {
};
render () {
const { locale, components } = this.props;
const { components } = this.props;
let handleOpenVideo;
@ -83,7 +78,7 @@ export default class MediaContainer extends PureComponent {
}
return (
<IntlProvider locale={locale} messages={messages} onError={onProviderError}>
<IntlProvider>
<>
{[].map.call(components, (component, i) => {
const componentName = component.getAttribute('data-component');