Split Raise Hand plurals into separate strings.

This commit is contained in:
Nicholas Tinsley
2024-06-11 11:43:58 -04:00
parent c4e64f6fa3
commit 0e57335be1
2 changed files with 21 additions and 12 deletions

View File

@@ -37,7 +37,6 @@ 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
@@ -151,7 +150,9 @@ private fun RaiseHand(
Icon(
imageVector = ImageVector.vectorResource(id = R.drawable.symbol_raise_hand_24),
contentDescription = null,
modifier = Modifier.align(Alignment.CenterVertically).padding(vertical = 8.dp)
modifier = Modifier
.align(Alignment.CenterVertically)
.padding(vertical = 8.dp)
)
Text(
@@ -194,10 +195,20 @@ private fun getSnackbarText(state: RaiseHandState): String {
if (state.isEmpty) {
return ""
}
val displayedName = getShortDisplayName(raisedHands = state.raisedHands)
return if (!state.isExpanded) {
pluralStringResource(id = R.plurals.CallRaiseHandSnackbar_raised_hands, count = state.raisedHands.size, getShortDisplayName(state.raisedHands), state.raisedHands.size - 1)
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)
}
} else {
pluralStringResource(id = R.plurals.CallOverflowPopupWindow__raised_a_hand, count = state.raisedHands.size, state.raisedHands.first().sender.getShortRecipientDisplayName(LocalContext.current), state.raisedHands.size - 1)
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)
}
}
}

View File

@@ -2080,17 +2080,15 @@
<!-- A button to take you to a list of participants with raised hands -->
<string name="CallOverflowPopupWindow__view">View</string>
<!-- 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. -->
<plurals name="CallOverflowPopupWindow__raised_a_hand">
<item quantity="one">%1$s raised a hand</item>
<item quantity="other">%1$s +%2$d raised a hand</item>
</plurals>
<string name="CallRaiseHandSnackbar__raised_a_hand_plural">%1$s +%2$d raised a hand</string>
<!-- 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. -->
<plurals name="CallRaiseHandSnackbar_raised_hands">
<item quantity="one">%1$s</item>
<item quantity="other">%1$s +%2$d</item>
</plurals>
<string name="CallRaiseHandSnackbar_raised_hands_plural">%1$s +%2$d</string>
<!-- 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>