[Glitch] Add lang attribute to media and poll options

Port d3eefead30 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Christian Schmidt
2023-02-26 20:13:27 +01:00
committed by Claire
parent 276c1d32d6
commit 0e476f3c4f
15 changed files with 80 additions and 24 deletions

View File

@ -2,11 +2,17 @@ import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import Video from 'flavours/glitch/features/video';
import { connect } from 'react-redux';
import ImmutablePureComponent from 'react-immutable-pure-component';
import Footer from 'flavours/glitch/features/picture_in_picture/components/footer';
import { getAverageFromBlurhash } from 'flavours/glitch/blurhash';
export default class VideoModal extends ImmutablePureComponent {
const mapStateToProps = (state, { statusId }) => ({
language: state.getIn(['statuses', statusId, 'language']),
});
export default @connect(mapStateToProps, null, null, { forwardRef: true })
class VideoModal extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object,
@ -15,6 +21,7 @@ export default class VideoModal extends ImmutablePureComponent {
static propTypes = {
media: ImmutablePropTypes.map.isRequired,
statusId: PropTypes.string,
language: PropTypes.string,
options: PropTypes.shape({
startTime: PropTypes.number,
autoPlay: PropTypes.bool,
@ -35,7 +42,7 @@ export default class VideoModal extends ImmutablePureComponent {
}
render () {
const { media, statusId, onClose } = this.props;
const { media, statusId, language, onClose } = this.props;
const options = this.props.options || {};
return (
@ -53,6 +60,7 @@ export default class VideoModal extends ImmutablePureComponent {
autoFocus
detailed
alt={media.get('description')}
lang={language}
/>
</div>