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

@ -40,6 +40,7 @@ class Poll extends ImmutablePureComponent {
static propTypes = {
poll: ImmutablePropTypes.map,
lang: PropTypes.string,
intl: PropTypes.object.isRequired,
disabled: PropTypes.bool,
refresh: PropTypes.func,
@ -126,7 +127,7 @@ class Poll extends ImmutablePureComponent {
};
renderOption (option, optionIndex, showResults) {
const { poll, disabled, intl } = this.props;
const { poll, lang, disabled, intl } = this.props;
const pollVotesCount = poll.get('voters_count') || poll.get('votes_count');
const percent = pollVotesCount === 0 ? 0 : (option.get('votes_count') / pollVotesCount) * 100;
const leading = poll.get('options').filterNot(other => other.get('title') === option.get('title')).every(other => option.get('votes_count') >= other.get('votes_count'));
@ -159,6 +160,7 @@ class Poll extends ImmutablePureComponent {
onKeyPress={this.handleOptionKeyPress}
aria-checked={active}
aria-label={option.get('title')}
lang={lang}
data-index={optionIndex}
/>
)}
@ -175,6 +177,7 @@ class Poll extends ImmutablePureComponent {
<span
className='poll__option__text translate'
lang={lang}
dangerouslySetInnerHTML={{ __html: titleEmojified }}
/>