Convert a11y_polls_percent_of_total to plurals

This commit is contained in:
Benoit Marty
2025-06-13 13:04:24 +02:00
parent 9028241629
commit cfe33df5aa
2 changed files with 7 additions and 2 deletions

View File

@@ -56,7 +56,9 @@ internal fun PollAnswerView(
append(nbVotesText)
if (answerItem.votesCount != 0) {
append(sentenceDelimiter)
append(stringResource(R.string.a11y_polls_percent_of_total, (answerItem.percentage * 100).toInt()))
(answerItem.percentage * 100).toInt().let { percent ->
append(pluralStringResource(R.plurals.a11y_polls_percent_of_total, percent, percent))
}
}
if (answerItem.isWinner) {
append(sentenceDelimiter)

View File

@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="a11y_polls_percent_of_total">"%1$d percent of total votes"</string>
<plurals name="a11y_polls_percent_of_total">
<item quantity="one">"%1$d percent of total votes"</item>
<item quantity="other">"%1$d percents of total votes"</item>
</plurals>
<string name="a11y_polls_winning_answer">"This is the winning answer"</string>
</resources>