mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 01:15:54 +03:00
Use plurals for proper i18n
This commit is contained in:
parent
206e68b1d2
commit
1eac90e5b1
2 changed files with 15 additions and 8 deletions
|
@ -110,25 +110,25 @@ internal class RoomDisplayNameResolver @Inject constructor(
|
|||
}
|
||||
val otherMembersCount = otherMembersSubset.count()
|
||||
name = when (otherMembersCount) {
|
||||
0 -> {
|
||||
0 -> {
|
||||
stringProvider.getString(R.string.room_displayname_empty_room)
|
||||
// TODO (was xx and yyy) ...
|
||||
}
|
||||
1 -> resolveRoomMemberName(otherMembersSubset[0], roomMembers)
|
||||
2 -> {
|
||||
1 -> resolveRoomMemberName(otherMembersSubset[0], roomMembers)
|
||||
2 -> {
|
||||
stringProvider.getString(R.string.room_displayname_two_members,
|
||||
resolveRoomMemberName(otherMembersSubset[0], roomMembers),
|
||||
resolveRoomMemberName(otherMembersSubset[1], roomMembers)
|
||||
)
|
||||
}
|
||||
3 -> {
|
||||
3 -> {
|
||||
stringProvider.getString(R.string.room_displayname_3_members,
|
||||
resolveRoomMemberName(otherMembersSubset[0], roomMembers),
|
||||
resolveRoomMemberName(otherMembersSubset[1], roomMembers),
|
||||
resolveRoomMemberName(otherMembersSubset[2], roomMembers)
|
||||
)
|
||||
}
|
||||
4 -> {
|
||||
4 -> {
|
||||
stringProvider.getString(R.string.room_displayname_4_members,
|
||||
resolveRoomMemberName(otherMembersSubset[0], roomMembers),
|
||||
resolveRoomMemberName(otherMembersSubset[1], roomMembers),
|
||||
|
@ -138,7 +138,9 @@ internal class RoomDisplayNameResolver @Inject constructor(
|
|||
}
|
||||
else -> {
|
||||
val remainingCount = invitedCount + joinedCount - otherMembersCount + 1
|
||||
stringProvider.getString(R.string.room_displayname_four_and_more_members,
|
||||
stringProvider.getQuantityString(
|
||||
R.plurals.room_displayname_four_and_more_members,
|
||||
remainingCount,
|
||||
resolveRoomMemberName(otherMembersSubset[0], roomMembers),
|
||||
resolveRoomMemberName(otherMembersSubset[1], roomMembers),
|
||||
resolveRoomMemberName(otherMembersSubset[2], roomMembers),
|
||||
|
|
|
@ -175,10 +175,15 @@
|
|||
|
||||
<!-- The 2 parameters will be members' name -->
|
||||
<string name="room_displayname_two_members">%1$s and %2$s</string>
|
||||
<!-- The 3 parameters will be members' name -->
|
||||
<string name="room_displayname_3_members">%1$s, %2$s and %3$s</string>
|
||||
<!-- The 4 parameters will be members' name -->
|
||||
<string name="room_displayname_4_members">%1$s, %2$s, %3$s and %4$s</string>
|
||||
<string name="room_displayname_four_and_more_members">%1$s, %2$s, %3$s and %4$d others</string>
|
||||
|
||||
<!-- The 3 first parameters will be members' name -->
|
||||
<plurals name="room_displayname_four_and_more_members">
|
||||
<item quantity="one">%1$s, %2$s, %3$s and %4$d other</item>
|
||||
<item quantity="other">%1$s, %2$s, %3$s and %4$d others</item>
|
||||
</plurals>
|
||||
<plurals name="room_displayname_three_and_more_members">
|
||||
<item quantity="one">%1$s and 1 other</item>
|
||||
<item quantity="other">%1$s and %2$d others</item>
|
||||
|
|
Loading…
Reference in a new issue