0
0
Fork 0

Add lang attribute to media and poll options (#23891)

This commit is contained in:
Christian Schmidt 2023-02-26 20:13:27 +01:00 committed by GitHub
parent 730bb3e211
commit d3eefead30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 79 additions and 24 deletions

View file

@ -3,6 +3,7 @@ import ReactSwipeableViews from 'react-swipeable-views';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import Video from 'mastodon/features/video';
import { connect } from 'react-redux';
import classNames from 'classnames';
import { defineMessages, injectIntl } from 'react-intl';
import IconButton from 'mastodon/components/icon_button';
@ -20,7 +21,12 @@ const messages = defineMessages({
next: { id: 'lightbox.next', defaultMessage: 'Next' },
});
export default @injectIntl
const mapStateToProps = (state, { statusId }) => ({
language: state.getIn(['statuses', statusId, 'language']),
});
export default @connect(mapStateToProps, null, null, { forwardRef: true })
@injectIntl
class MediaModal extends ImmutablePureComponent {
static propTypes = {
@ -129,7 +135,7 @@ class MediaModal extends ImmutablePureComponent {
};
render () {
const { media, statusId, intl, onClose } = this.props;
const { media, language, statusId, intl, onClose } = this.props;
const { navigationHidden } = this.state;
const index = this.getIndex();
@ -149,6 +155,7 @@ class MediaModal extends ImmutablePureComponent {
width={width}
height={height}
alt={image.get('description')}
lang={language}
key={image.get('url')}
onClick={this.toggleNavigation}
zoomButtonHidden={this.state.zoomButtonHidden}
@ -171,6 +178,7 @@ class MediaModal extends ImmutablePureComponent {
onCloseVideo={onClose}
detailed
alt={image.get('description')}
lang={language}
key={image.get('url')}
/>
);
@ -182,6 +190,7 @@ class MediaModal extends ImmutablePureComponent {
height={height}
key={image.get('preview_url')}
alt={image.get('description')}
lang={language}
onClick={this.toggleNavigation}
/>
);