Differently pluralize raise hand strings.

This commit is contained in:
Nicholas Tinsley 2024-06-17 11:51:09 -04:00 committed by Greyson Parrelli
parent 14cacaef86
commit 2acb47952b
2 changed files with 13 additions and 4 deletions

View file

@ -37,6 +37,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.semantics.Role
@ -197,17 +198,18 @@ private fun getSnackbarText(state: RaiseHandState): String {
}
val displayedName = getShortDisplayName(raisedHands = state.raisedHands)
val additionalHandsCount = state.raisedHands.size - 1
return if (!state.isExpanded) {
if (state.raisedHands.size == 1) {
stringResource(id = R.string.CallRaiseHandSnackbar_raised_hands_singular, displayedName)
} else {
stringResource(id = R.string.CallRaiseHandSnackbar_raised_hands_plural, displayedName, state.raisedHands.size - 1)
pluralStringResource(id = R.plurals.CallRaiseHandSnackbar_raised_hands_plural, count = additionalHandsCount, displayedName, state.raisedHands.size - 1)
}
} else {
if (state.raisedHands.size == 1) {
stringResource(id = R.string.CallRaiseHandSnackbar__raised_a_hand_singular, displayedName)
} else {
stringResource(id = R.string.CallRaiseHandSnackbar__raised_a_hand_plural, displayedName, state.raisedHands.size - 1)
pluralStringResource(id = R.plurals.CallRaiseHandSnackbar__raised_a_hand_plural, count = additionalHandsCount, displayedName, state.raisedHands.size - 1)
}
}
}

View file

@ -2137,12 +2137,19 @@
<!-- A notification to the user that one or more participants in the call successfully raised their hand. The placeholder string may either be a name, or "You". -->
<string name="CallRaiseHandSnackbar__raised_a_hand_singular">%1$s raised a hand</string>
<!-- A notification to the user that one or more participants in the call successfully raised their hand. The first string may either be a name, or "You". The second placeholder is a number quantifying how many other hands are also raised. -->
<string name="CallRaiseHandSnackbar__raised_a_hand_plural">%1$s +%2$d raised a hand</string>
<plurals name="CallRaiseHandSnackbar__raised_a_hand_plural">
<item quantity="one">%1$s +%2$d raised a hand</item>
<item quantity="other">%1$s +%2$d raised a hand</item>
</plurals>
<!-- A badge to show how many hands are raised. The placeholder string may either be a name, or "You". -->
<string name="CallRaiseHandSnackbar_raised_hands_singular">%1$s</string>
<!-- A badge to show how many hands are raised. The first string may either be a name, or "You". The second placeholder is a number quantifying how many other hands are also raised. -->
<string name="CallRaiseHandSnackbar_raised_hands_plural">%1$s +%2$d</string>
<plurals name="CallRaiseHandSnackbar_raised_hands_plural">
<item quantity="one">%1$s +%2$d</item>
<item quantity="other">%1$s +%2$d</item>
</plurals>
<!-- An accessibility label for screen readers on a view that can be expanded -->
<string name="CallOverflowPopupWindow__expand_snackbar_accessibility_label">Expand raised hand view</string>