From e5e4e4b2bfb13df6ac1ccc7c4b43e9fd76eb260c Mon Sep 17 00:00:00 2001 From: Jordan Rose Date: Thu, 11 Aug 2022 12:51:51 -0700 Subject: [PATCH] Fix message for an ongoing group call with three people There's no reason to special-case "three" vs "four or more" in our current format (rather than using "three or more"), and in fact the "three" case wasn't using correct English (it was correct in the PluralAware table, though). Update both the in-call title text and the conversation item to use the PluralAware "many" version for "three or more" people in a call. --- .../src/Calls/UserInterface/CallHeader.swift | 6 ------ .../translations/en.lproj/Localizable.strings | 6 ------ .../src/Messages/OWSGroupCallMessage.m | 21 +++++++------------ 3 files changed, 7 insertions(+), 26 deletions(-) diff --git a/Signal/src/Calls/UserInterface/CallHeader.swift b/Signal/src/Calls/UserInterface/CallHeader.swift index 63894d12d3..836a3a6c69 100644 --- a/Signal/src/Calls/UserInterface/CallHeader.swift +++ b/Signal/src/Calls/UserInterface/CallHeader.swift @@ -224,12 +224,6 @@ class CallHeader: UIView { comment: "Text explaining that there are two people in the group call. Embeds {{ %1$@ participant1, %2$@ participant2 }}" ) callTitleText = String(format: formatString, memberNames[0], memberNames[1]) - case 3: - let formatString = NSLocalizedString( - "GROUP_CALL_THREE_PEOPLE_HERE_FORMAT", - comment: "Text explaining that there are three people in the group call. Embeds {{ %1$@ participant1, %2$@ participant2 }}" - ) - callTitleText = String(format: formatString, memberNames[0], memberNames[1]) default: let formatString = NSLocalizedString( "GROUP_CALL_MANY_PEOPLE_HERE_%d", tableName: "PluralAware", diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index d41f338a4b..7ea82ceb6f 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -2242,9 +2242,6 @@ /* Button to leave a group call */ "GROUP_CALL_LEAVE_BUTTON" = "Leave Call"; -/* Text explaining that there are more than three people in the group call. Embeds {{ %1$@ participant1, %2$@ participant2, %3$@ participantCount-2 }} */ -"GROUP_CALL_MANY_PEOPLE_HERE_FORMAT" = "%1$@, %2$@, and %3$@ others are in this call"; - /* String displayed in cell when media from a user can't be displayed in group call grid. Embeds {user's name} */ "GROUP_CALL_MISSING_MEDIA_KEYS_FORMAT" = "Can't receive audio & video from %@"; @@ -2305,9 +2302,6 @@ /* Text explaining that someone started a group call. Embeds {{call creator display name}} */ "GROUP_CALL_STARTED_MESSAGE_FORMAT" = "%@ started a group call"; -/* Text explaining that there are three people in the group call. Embeds {{ %1$@ participant1, %2$@ participant2 }} */ -"GROUP_CALL_THREE_PEOPLE_HERE_FORMAT" = "%1$@, %2$@, and 1 other is in this call"; - /* Text explaining that there are two people in the group call. Embeds {{ %1$@ participant1, %2$@ participant2 }} */ "GROUP_CALL_TWO_PEOPLE_HERE_FORMAT" = "%1$@ and %2$@ are in this call"; diff --git a/SignalServiceKit/src/Messages/OWSGroupCallMessage.m b/SignalServiceKit/src/Messages/OWSGroupCallMessage.m index e07f9befd3..46fd1db561 100644 --- a/SignalServiceKit/src/Messages/OWSGroupCallMessage.m +++ b/SignalServiceKit/src/Messages/OWSGroupCallMessage.m @@ -167,12 +167,11 @@ NS_ASSUME_NONNULL_BEGIN - (NSString *)systemTextWithTransaction:(SDSAnyReadTransaction *)transaction { - NSString *moreThanThreeFormat = OWSLocalizedString(@"GROUP_CALL_MANY_PEOPLE_HERE_FORMAT", - @"Text explaining that there are more than three people in the group call. Embeds {{ %1$@ participant1, %2$@ " - @"participant2, %3$@ participantCount-2 }}"); - NSString *threeFormat = OWSLocalizedString(@"GROUP_CALL_THREE_PEOPLE_HERE_FORMAT", - @"Text explaining that there are three people in the group call. Embeds {{ %1$@ participant1, %2$@ " - @"participant2 }}"); + NSString *threeOrMoreFormat = NSLocalizedStringFromTableInBundle(@"GROUP_CALL_MANY_PEOPLE_HERE_%d", + @"PluralAware", + NSBundle.mainBundle.appBundle, + @"Text explaining that there are three or more people in the group call. Embeds {{ %1$@ participantCount-2, " + @"%2$@ participant1, %3$@ participant2 }}"); NSString *twoFormat = OWSLocalizedString(@"GROUP_CALL_TWO_PEOPLE_HERE_FORMAT", @"Text explaining that there are two people in the group call. Embeds {{ %1$@ participant1, %2$@ participant2 " @"}}"); @@ -209,16 +208,10 @@ NS_ASSUME_NONNULL_BEGIN if (self.hasEnded) { return endedString; - } else if (sortedAddresses.count >= 4) { + } else if (sortedAddresses.count >= 3) { NSString *firstName = [self participantNameForAddress:sortedAddresses[0] transaction:transaction]; NSString *secondName = [self participantNameForAddress:sortedAddresses[1] transaction:transaction]; - NSString *remainingCount = [OWSFormat formatInt:(sortedAddresses.count - 2)]; - return [NSString stringWithFormat:moreThanThreeFormat, firstName, secondName, remainingCount]; - - } else if (sortedAddresses.count == 3) { - NSString *firstName = [self participantNameForAddress:sortedAddresses[0] transaction:transaction]; - NSString *secondName = [self participantNameForAddress:sortedAddresses[1] transaction:transaction]; - return [NSString stringWithFormat:threeFormat, firstName, secondName]; + return [NSString localizedStringWithFormat:threeOrMoreFormat, sortedAddresses.count - 2, firstName, secondName]; } else if (sortedAddresses.count == 2) { NSString *firstName = [self participantNameForAddress:sortedAddresses[0] transaction:transaction];