about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/components/poll.jsx
diff options
context:
space:
mode:
authorChristian Schmidt <github@chsc.dk>2023-02-26 20:13:27 +0100
committerClaire <claire.github-309c@sitedethib.com>2023-03-05 17:52:53 +0100
commit0e476f3c4fbbcab9b4895b8abff93075dfd2bf0c (patch)
treeae50a1c4344476421eb36fc254ec9bbcfcfc6f8a /app/javascript/flavours/glitch/components/poll.jsx
parent276c1d32d6fc857a768244c3f5d835c9c5da1747 (diff)
[Glitch] Add `lang` attribute to media and poll options
Port d3eefead3014175b264cb56f6f4cb552cbaaeac6 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/components/poll.jsx')
-rw-r--r--app/javascript/flavours/glitch/components/poll.jsx5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/components/poll.jsx b/app/javascript/flavours/glitch/components/poll.jsx
index 53ece560e..8b799309b 100644
--- a/app/javascript/flavours/glitch/components/poll.jsx
+++ b/app/javascript/flavours/glitch/components/poll.jsx
@@ -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 }}
           />