Skip to content

Commit

Permalink
fix: enable translations in plurals for failed to add and failed to s…
Browse files Browse the repository at this point in the history
…end messages (WPB-3788) (#2170)
  • Loading branch information
yamilmedina committed Sep 4, 2023
1 parent 47891fb commit a72e67c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private fun MultiUserDeliveryFailure(
if (partialDeliveryFailureContent.filteredRecipientsFailure.isNotEmpty()) {
Text(
text = stringResource(
id = R.string.label_message_partial_delivery_participants_deliver_later,
id = R.string.label_message_partial_delivery_participants_many_deliver_later,
partialDeliveryFailureContent.filteredRecipientsFailure
.filter {
!it.asString(resources).contentEquals(resources.getString(R.string.username_unavailable_label))
Expand Down Expand Up @@ -166,7 +166,7 @@ private fun SingleUserDeliveryFailure(
if (partialDeliveryFailureContent.failedRecipients.isNotEmpty()) {
Text(
text = stringResource(
id = R.string.label_message_partial_delivery_participants_deliver_later,
id = R.string.label_message_partial_delivery_participants_one_deliver_later,
partialDeliveryFailureContent.failedRecipients.joinToString(", ") {
it.asString(resources).ifEmpty { resources.getString(R.string.username_unavailable_label) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -612,8 +612,14 @@ private fun SystemMessage.MemberFailedToAdd.toFailedToAddAnnotatedText(
if (isMultipleUsersFailure) failedToAddAnnotatedText.append("\n")
failedToAddAnnotatedText.append(
res.annotatedText(
stringResId, normalStyle, boldStyle, normalColor, boldColor, errorColor, isErrorString,
memberNames.limitUserNamesList(res, usersCount).toUserNamesListString(res)
stringResId,
normalStyle,
boldStyle,
normalColor,
boldColor,
errorColor,
isErrorString,
memberNames.limitUserNamesList(res, EXPANDABLE_THRESHOLD).toUserNamesListString(res)
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,11 @@ sealed class UIMessageContent {
val memberNames: List<UIText>
) : SystemMessage(
R.drawable.ic_info,
R.string.label_system_message_conversation_failed_add_members_details
if (memberNames.size > 1) {
R.string.label_system_message_conversation_failed_add_many_members_details
} else {
R.string.label_system_message_conversation_failed_add_one_member_details
}
) {
val usersCount = memberNames.size
}
Expand Down
19 changes: 10 additions & 9 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@
<string name="label_message_knock">%s pinged</string>
<string name="label_message_partial_delivery_participants_count">%1$d participants didn\'t get your message.</string>
<string name="label_message_partial_delivery_participants_wont_deliver">%s won\'t get your message.</string>
<string name="label_message_partial_delivery_participants_deliver_later">%s will get your message later.</string>
<string name="label_message_partial_delivery_participants_one_deliver_later">%s will get your message later.</string>
<string name="label_message_partial_delivery_participants_many_deliver_later">%s will get your message later.</string>
<plurals name="label_message_partial_delivery_x_participants_from_backend">
<item quantity="one">1 participant from %2$s</item>
<item quantity="other">%1$d participants from %2$s</item>
</plurals>
<string name="label_try_again">Try again</string>
<string name="label_reset_session">Reset Session</string>
<string name="label_reset_session_success">Session successfully reset</string>
<string name="label_federated_membership">Federated</string>
Expand Down Expand Up @@ -173,13 +173,13 @@

<!-- Non translatable strings-->
<string name="url_support" translatable="false">https://support.wire.com</string>
<string name="url_decryption_failure_learn_more" translatable="false">https://support.wire.com/hc/en-us/articles/207948115-Why-was-I-notified-that-a-message-from-a-contact-was-not-received-</string>
<string name="url_welcome_to_new_android" translatable="false">https://support.wire.com/hc/en-us/articles/6655706999581-What-s-new-on-Android-</string>
<string name="url_message_details_reactions_learn_more" translatable="false">https://support.wire.com/hc/en-us/articles/212053645-Like-a-message</string>
<string name="url_message_details_read_receipts_learn_more" translatable="false">https://support.wire.com/hc/en-us/articles/360000665277-Activate-or-deactivate-read-receipts</string>
<string name="url_decryption_failure_learn_more" translatable="false">https://support.wire.com/hc/articles/207948115-Why-was-I-notified-that-a-message-from-a-contact-was-not-received-</string>
<string name="url_welcome_to_new_android" translatable="false">https://support.wire.com/hc/articles/6655706999581-What-s-new-on-Android-</string>
<string name="url_message_details_reactions_learn_more" translatable="false">https://support.wire.com/hc/articles/212053645-Like-a-message</string>
<string name="url_message_details_read_receipts_learn_more" translatable="false">https://support.wire.com/hc/articles/360000665277-Activate-or-deactivate-read-receipts</string>
<string name="url_message_details_offline_backends_learn_more" translatable="false">https://support.wire.com/hc/articles/9357718008093-Backend</string>
<string name="url_self_client_verification_learn_more" translatable="false">https://support.wire.com/hc/en-us/articles/207693005-How-can-I-verify-my-own-devices-</string>
<string name="url_self_client_fingerprint_learn_more" translatable="false">https://support.wire.com/hc/en-us/articles/207692235-How-can-I-compare-key-fingerprints-</string>
<string name="url_self_client_verification_learn_more" translatable="false">https://support.wire.com/hc/articles/207693005-How-can-I-verify-my-own-devices-</string>
<string name="url_self_client_fingerprint_learn_more" translatable="false">https://support.wire.com/hc/articles/207692235-How-can-I-compare-key-fingerprints-</string>
<string name="url_federation_support" translatable="false">https://support.wire.com/hc/categories/4719917054365-Federation</string>
<!-- Navigation -->
<string name="vault_screen_title">Vault</string>
Expand Down Expand Up @@ -588,7 +588,8 @@
<string name="label_system_message_conversation_started_by_other">%1$s started the conversation</string>
<string name="label_system_message_conversation_started_with_members">With %1$s</string>
<string name="label_system_message_conversation_failed_add_members_summary">%1$s **participants** could not be added to the group.</string>
<string name="label_system_message_conversation_failed_add_members_details">%1$s could not be added to the group.</string>
<string name="label_system_message_conversation_failed_add_many_members_details">%1$s could not be added to the group.</string>
<string name="label_system_message_conversation_failed_add_one_member_details">%1$s could not be added to the group.</string>
<string name="label_system_message_conversation_degraded">This conversation is no longer verified, as some user uses at least one device without a valid end-to-end identity certificate.</string>
<!-- Last messages -->
<plurals name="last_message_self_added_users">
Expand Down

0 comments on commit a72e67c

Please sign in to comment.