Skip to content

Commit 2cab05e

Browse files
committed
Convert a11y_polls_percent_of_total to plurals
1 parent ad64903 commit 2cab05e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

features/poll/api/src/main/kotlin/io/element/android/features/poll/api/pollcontent/PollAnswerView.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ internal fun PollAnswerView(
5656
append(nbVotesText)
5757
if (answerItem.votesCount != 0) {
5858
append(sentenceDelimiter)
59-
append(stringResource(R.string.a11y_polls_percent_of_total, (answerItem.percentage * 100).toInt()))
59+
(answerItem.percentage * 100).toInt().let { percent ->
60+
append(pluralStringResource(R.plurals.a11y_polls_percent_of_total, percent, percent))
61+
}
6062
}
6163
if (answerItem.isWinner) {
6264
append(sentenceDelimiter)
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
3-
<string name="a11y_polls_percent_of_total">"%1$d percent of total votes"</string>
3+
<plurals name="a11y_polls_percent_of_total">
4+
<item quantity="one">"%1$d percent of total votes"</item>
5+
<item quantity="other">"%1$d percents of total votes"</item>
6+
</plurals>
47
<string name="a11y_polls_winning_answer">"This is the winning answer"</string>
58
</resources>

0 commit comments

Comments
 (0)