Changes string into plural

This commit is contained in:
ericdecanini 2022-07-18 14:47:09 +02:00
parent 051f925f0e
commit 13b9b5b5d6
2 changed files with 7 additions and 5 deletions

View File

@ -214,11 +214,11 @@ class RoomSummaryItemFactory @Inject constructor(
} }
private fun joinParentNames(roomSummary: RoomSummary) = with(roomSummary) { private fun joinParentNames(roomSummary: RoomSummary) = with(roomSummary) {
when (directParentNames.size) { when (val size = directParentNames.size) {
0 -> null 0 -> null
1 -> directParentNames.first() 1 -> directParentNames.first()
2 -> stringProvider.getString(R.string.search_space_two_parents, directParentNames[0], directParentNames[1]) 2 -> stringProvider.getQuantityString(R.plurals.search_space_parents, 1, directParentNames[0], directParentNames[1])
else -> stringProvider.getString(R.string.search_space_multiple_parents, directParentNames.first(), directParentNames.size - 1) else -> stringProvider.getQuantityString(R.plurals.search_space_parents, size - 1, directParentNames[0], directParentNames.size - 1)
} }
} }
} }

View File

@ -762,8 +762,10 @@
<string name="search_members_hint">Filter room members</string> <string name="search_members_hint">Filter room members</string>
<string name="search_banned_user_hint">Filter banned users</string> <string name="search_banned_user_hint">Filter banned users</string>
<string name="search_no_results">No results</string> <string name="search_no_results">No results</string>
<string name="search_space_two_parents">%1$s and %2$s</string> <plurals name="search_space_parents">
<string name="search_space_multiple_parents">%1$s and %2$d others</string> <item quantity="one">%1$s and %2$s</item>
<item quantity="other">%1$s and %2$d others</item>
</plurals>
<!-- home room settings --> <!-- home room settings -->
<string name="room_settings_all_messages">All messages</string> <string name="room_settings_all_messages">All messages</string>