Skip to content

Commit 0e57335

Browse files
Split Raise Hand plurals into separate strings.
1 parent c4e64f6 commit 0e57335

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

app/src/main/java/org/thoughtcrime/securesms/components/webrtc/controls/RaiseHandSnackbar.kt

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import androidx.compose.ui.Modifier
3737
import androidx.compose.ui.draw.clip
3838
import androidx.compose.ui.graphics.vector.ImageVector
3939
import androidx.compose.ui.platform.LocalContext
40-
import androidx.compose.ui.res.pluralStringResource
4140
import androidx.compose.ui.res.stringResource
4241
import androidx.compose.ui.res.vectorResource
4342
import androidx.compose.ui.semantics.Role
@@ -151,7 +150,9 @@ private fun RaiseHand(
151150
Icon(
152151
imageVector = ImageVector.vectorResource(id = R.drawable.symbol_raise_hand_24),
153152
contentDescription = null,
154-
modifier = Modifier.align(Alignment.CenterVertically).padding(vertical = 8.dp)
153+
modifier = Modifier
154+
.align(Alignment.CenterVertically)
155+
.padding(vertical = 8.dp)
155156
)
156157

157158
Text(
@@ -194,10 +195,20 @@ private fun getSnackbarText(state: RaiseHandState): String {
194195
if (state.isEmpty) {
195196
return ""
196197
}
198+
199+
val displayedName = getShortDisplayName(raisedHands = state.raisedHands)
197200
return if (!state.isExpanded) {
198-
pluralStringResource(id = R.plurals.CallRaiseHandSnackbar_raised_hands, count = state.raisedHands.size, getShortDisplayName(state.raisedHands), state.raisedHands.size - 1)
201+
if (state.raisedHands.size == 1) {
202+
stringResource(id = R.string.CallRaiseHandSnackbar_raised_hands_singular, displayedName)
203+
} else {
204+
stringResource(id = R.string.CallRaiseHandSnackbar_raised_hands_plural, displayedName, state.raisedHands.size - 1)
205+
}
199206
} else {
200-
pluralStringResource(id = R.plurals.CallOverflowPopupWindow__raised_a_hand, count = state.raisedHands.size, state.raisedHands.first().sender.getShortRecipientDisplayName(LocalContext.current), state.raisedHands.size - 1)
207+
if (state.raisedHands.size == 1) {
208+
stringResource(id = R.string.CallRaiseHandSnackbar__raised_a_hand_singular, displayedName)
209+
} else {
210+
stringResource(id = R.string.CallRaiseHandSnackbar__raised_a_hand_plural, displayedName, state.raisedHands.size - 1)
211+
}
201212
}
202213
}
203214

app/src/main/res/values/strings.xml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2080,17 +2080,15 @@
20802080
<!-- A button to take you to a list of participants with raised hands -->
20812081
<string name="CallOverflowPopupWindow__view">View</string>
20822082

2083+
<!-- 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". -->
2084+
<string name="CallRaiseHandSnackbar__raised_a_hand_singular">%1$s raised a hand</string>
20832085
<!-- 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. -->
2084-
<plurals name="CallOverflowPopupWindow__raised_a_hand">
2085-
<item quantity="one">%1$s raised a hand</item>
2086-
<item quantity="other">%1$s +%2$d raised a hand</item>
2087-
</plurals>
2086+
<string name="CallRaiseHandSnackbar__raised_a_hand_plural">%1$s +%2$d raised a hand</string>
20882087

2088+
<!-- A badge to show how many hands are raised. The placeholder string may either be a name, or "You". -->
2089+
<string name="CallRaiseHandSnackbar_raised_hands_singular">%1$s</string>
20892090
<!-- 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. -->
2090-
<plurals name="CallRaiseHandSnackbar_raised_hands">
2091-
<item quantity="one">%1$s</item>
2092-
<item quantity="other">%1$s +%2$d</item>
2093-
</plurals>
2091+
<string name="CallRaiseHandSnackbar_raised_hands_plural">%1$s +%2$d</string>
20942092

20952093
<!-- An accessibility label for screen readers on a view that can be expanded -->
20962094
<string name="CallOverflowPopupWindow__expand_snackbar_accessibility_label">Expand raised hand view</string>

0 commit comments

Comments
 (0)