From ce8a1f59305190ff16bcbdcb26b0e307e41ec9d0 Mon Sep 17 00:00:00 2001 From: Alvaro <110414366+alvaro-signal@users.noreply.github.com> Date: Mon, 23 Jan 2023 13:42:40 -0700 Subject: [PATCH] Don't use the term gift --- _locales/en/messages.json | 114 +++++++++++++++--- ts/components/OutgoingGiftBadgeModal.tsx | 8 +- ts/components/ToastManager.tsx | 4 +- ts/components/conversation/Message.tsx | 28 ++--- ts/components/conversation/Quote.tsx | 2 +- ts/models/messages.ts | 16 ++- .../state/ducks/conversations_test.ts | 4 +- 7 files changed, 130 insertions(+), 46 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index ef3e4ad7245d..0f5fa2c2ae39 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -2283,83 +2283,159 @@ }, "giftBadge--missing": { "message": "Unable to fetch gift badge details", - "description": "Aria label for gift badge when we can't fetch the details" + "description": "(deleted 2023/01/20) Aria label for gift badge when we can't fetch the details" + }, + "icu:donation--missing": { + "messageformat": "Unable to fetch donation details", + "description": "Aria label for donation when we can't fetch the details." }, "message--giftBadge--unopened--incoming": { "message": "View this message on mobile to open it", - "description": "Shown in a message's bubble when you've received a gift badge from a contact" + "description": "(deleted 2023/01/20) Shown in a message's bubble when you've received a gift badge from a contact" + }, + "icu:message--donation--unopened--incoming": { + "messageformat": "View this message on mobile to open it", + "description": "Shown in a message's bubble when you've received a donation badge from a contact" }, "message--giftBadge--unopened--outgoing": { "message": "Tap this message on mobile to view your gift", - "description": "Shown in a message's bubble when you've sent a gift badge to a contact" + "description": "(deleted 2023/01/20) Shown in a message's bubble when you've sent a gift badge to a contact" + }, + "icu:message--donation--unopened--outgoing": { + "messageformat": "Tap this message on mobile to view your donation", + "description": "Shown in a message's bubble when you've sent a donation badge to a contact." }, "message--giftBadge--unopened--label": { "message": "Gift", - "description": "Shown in a message's bubble when you've received a gift badge from a contact" + "description": "(deleted 2023/01/20) Shown in a message's bubble when you've received a gift badge from a contact" + }, + "icu:message--donation--unopened--label": { + "messageformat": "{sender} donated to Signal on your behalf", + "description": "Shown in a message's bubble when you've received a donation badge from a contact." }, "message--giftBadge--unopened--toast--incoming": { "message": "Check your phone to open gift", - "description": "Shown when you've clicked on an incoming gift badge you haven't yet redeemed" + "description": "(deleted 2023/01/20) Shown when you've clicked on an incoming gift badge you haven't yet redeemed" + }, + "icu:message--donation--unopened--toast--incoming": { + "messageformat": "Check your phone to open this donation", + "description": "Shown when you've clicked on an incoming donation you haven't yet redeemed." }, "message--giftBadge--unopened--toast--outgoing": { "message": "Check your phone to view your gift", - "description": "Shown when you've clicked on an outgoing gift badge" + "description": "(deleted 2023/01/20) Shown when you've clicked on an outgoing gift badge" + }, + "icu:message--donation--unopened--toast--outgoing": { + "messageformat": "Check your phone to view your donation", + "description": "Shown when you've clicked on an outgoing donation badge." }, "message--giftBadge--preview--unopened": { "message": "You received a gift", - "description": "Shown to label the gift badge in notifications and the left pane" + "description": "(deleted 2023/01/20) Shown to label the gift badge in notifications and the left pane" + }, + "icu:message--donation--preview--unopened": { + "messageformat": "{sender} donated for you", + "description": "Shown to label the donation badge in notifications and the left pane." }, "message--giftBadge--preview--redeemed": { "message": "You redeemed a gift badge", - "description": "Shown to label the redeemed gift badge in notifications and the left pane" + "description": "(deleted 2023/01/20) Shown to label the redeemed gift badge in notifications and the left pane" + }, + "icu:message--donation--preview--redeemed": { + "messageformat": "You redeemed a donation", + "description": "Shown to label the redeemed donation badge in notifications and the left pane." }, "message--giftBadge--preview--sent": { "message": "You sent a gift badge", - "description": "Shown to label a gift badge you've sent in notifications and the left pane" + "description": "(deleted 2023/01/20) Shown to label a gift badge you've sent in notifications and the left pane" + }, + "icu:message--donation--preview--sent": { + "messageformat": "You donated for {recipient}", + "description": "Shown to label a donation badge you've sent in notifications and the left pane" }, "message--giftBadge": { "message": "Gift Badge", - "description": "Shown to label the gift badge you've redeemed on another device" + "description": "(deleted 2023/01/20) Shown to label the gift badge you've redeemed on another device" + }, + "icu:message--donation": { + "messageformat": "Donation", + "description": "Shown to label the donation badge you've redeemed on another device." }, "quote--giftBadge": { "message": "Gift", - "description": "Shown to label a gift badge you've replied to" + "description": "(deleted 2023/01/20) Shown to label a gift badge you've replied to" + }, + "icu:quote--donation": { + "messageformat": "Donation", + "description": "Shown to label a donation badge you've replied to." }, "message--giftBadge--remaining--days": { "message": "$days$ days remaining", - "description": "Describes how long remains for the gift badge you've redeemed on another device (only rendered for days > 1)" + "description": "(deleted 2023/01/20) Describes how long remains for the donation badge you've redeemed on another device (only rendered for days > 1)" + }, + "icu:message--donation--remaining--days": { + "messageformat": "{days} days remaining", + "description": "Describes how long remains for the donation badge you've redeemed on another device (only rendered for days > 1)." }, "message--giftBadge--remaining--hours": { "message": "$hours$ hours remaining", - "description": "Describes how long remains for the gift badge you've redeemed on another device (only rendered for hours > 1)" + "description": "(deleted 2023/01/20) Describes how long remains for the donation badge you've redeemed on another device (only rendered for hours > 1)" + }, + "icu:message--donation--remaining--hours": { + "messageformat": "{hours} hours remaining", + "description": "Describes how long remains for the donation badge you've redeemed on another device (only rendered for hours > 1)" }, "message--giftBadge--remaining--minutes": { "message": "$minutes$ minutes remaining", - "description": "Describes how long remains for the gift badge you've redeemed on another device (only rendered for minutes > 1)" + "description": "(deleted 2023/01/20) Describes how long remains for the donation badge you've redeemed on another device (only rendered for minutes > 1)" + }, + "icu:message--donation--remaining--minutes": { + "messageformat": "{minutes, plural, one {1 minute} other {# minutes}} remaining", + "description": "(deleted 2023/01/20) Describes how long remains for the donation badge you've redeemed on another device." }, "message--giftBadge--remaining--one-minute": { "message": "1 minute remaining", - "description": "Describes how long remains for the gift badge you've redeemed on another device" + "description": "(deleted 2023/01/20) Describes how long remains for the donation badge you've redeemed on another device" }, "message--giftBadge--expired": { "message": "Expired", - "description": "Shows that a gift badge is expired" + "description": "(deleted 2023/01/20) Shows that a gift badge is expired" + }, + "icu:message--donation--expired": { + "messageformat": "Expired", + "description": "Shows that a donation badge is expired" }, "message--giftBadge--view": { "message": "View", "description": "Shown when you've sent a gift badge to someone then opened it" }, + "icu:message--donation--view": { + "messageformat": "View", + "description": "Shown when you've sent a donation badge to someone then opened it" + }, "message--giftBadge--redeemed": { "message": "Redeemed", - "description": "Shown when you've redeemed the gift badge on another device" + "description": "(deleted 2023/01/20) Shown when you've redeemed the gift badge on another device" + }, + "icu:message--donation--redeemed": { + "messageformat": "Redeemed", + "description": "Shown when you've redeemed the donation badge on another device" }, "modal--giftBadge--title": { "message": "Thanks for your support!", - "description": "The title of the outgoing gift badge detail dialog" + "description": "(deleted 2023/01/20) The title of the outgoing gift badge detail dialog" + }, + "icu:modal--donation--title": { + "messageformat": "Thanks for your support!", + "description": "The title of the outgoing donation badge detail dialog" }, "modal--giftBadge--description": { "message": "You've gifted a badge to $name$. When they accept, they'll be given a choice to show or hide their badge.", - "description": "The description of the outgoing gift badge detail dialog" + "description": "(deleted 2023/01/20) The description of the outgoing gift badge detail dialog" + }, + "icu:modal--donation--description": { + "messageformat": "You've made a donation to Signal on behalf of {name}. They'll be given the option to show their support on their profile.", + "description": "The description of the outgoing donation badge detail dialog" }, "stickers--toast--InstallFailed": { "message": "Sticker pack could not be installed", diff --git a/ts/components/OutgoingGiftBadgeModal.tsx b/ts/components/OutgoingGiftBadgeModal.tsx index f2d7ba5c6264..4b802b856136 100644 --- a/ts/components/OutgoingGiftBadgeModal.tsx +++ b/ts/components/OutgoingGiftBadgeModal.tsx @@ -48,7 +48,7 @@ export function OutgoingGiftBadgeModal({ `${CLASS_NAME}__badge`, `${CLASS_NAME}__badge--missing` )} - aria-label={i18n('giftBadge--missing')} + aria-label={i18n('icu:donation--missing')} /> ); @@ -63,14 +63,14 @@ export function OutgoingGiftBadgeModal({ >
- {i18n('modal--giftBadge--title')} + {i18n('icu:modal--donation--title')}
- {i18n('modal--giftBadge--description', { name: recipientTitle })} + {i18n('icu:modal--donation--description', { name: recipientTitle })}
{badgeElement}
- {i18n('message--giftBadge')} + {i18n('icu:message--donation')}
diff --git a/ts/components/ToastManager.tsx b/ts/components/ToastManager.tsx index 3c14c432fba5..a0782efb2af5 100644 --- a/ts/components/ToastManager.tsx +++ b/ts/components/ToastManager.tsx @@ -82,7 +82,7 @@ export function ToastManager({ if (toastType === ToastType.CannotOpenGiftBadgeIncoming) { return ( - {i18n('message--giftBadge--unopened--toast--incoming')} + {i18n('icu:message--donation--unopened--toast--incoming')} ); } @@ -90,7 +90,7 @@ export function ToastManager({ if (toastType === ToastType.CannotOpenGiftBadgeOutgoing) { return ( - {i18n('message--giftBadge--unopened--toast--outgoing')} + {i18n('icu:message--donation--unopened--toast--outgoing')} ); } diff --git a/ts/components/conversation/Message.tsx b/ts/components/conversation/Message.tsx index dbeeb8d16177..67c8a1d95867 100644 --- a/ts/components/conversation/Message.tsx +++ b/ts/components/conversation/Message.tsx @@ -557,7 +557,7 @@ export class Message extends React.PureComponent { } if (giftBadge) { - const description = i18n(`message--giftBadge--unopened--${direction}`); + const description = i18n(`icu:message--donation--unopened--${direction}`); const isDescriptionRTL = getDirection(description) === 'rtl'; if (giftBadge.state === GiftBadgeStates.Unopened && !isDescriptionRTL) { @@ -1228,7 +1228,7 @@ export class Message extends React.PureComponent { } if (giftBadge.state === GiftBadgeStates.Unopened) { - const description = i18n(`message--giftBadge--unopened--${direction}`); + const description = i18n(`icu:message--donation--unopened--${direction}`); const isRTL = getDirection(description) === 'rtl'; const { metadataWidth } = this.state; @@ -1239,7 +1239,9 @@ export class Message extends React.PureComponent { 'module-message__unopened-gift-badge', `module-message__unopened-gift-badge--${direction}` )} - aria-label={i18n('message--giftBadge--unopened--label')} + aria-label={i18n('icu:message--donation--unopened--label', { + sender: conversationTitle, + })} >
{ const remainingMinutes = Math.floor(duration / MINUTE); if (remainingDays > 1) { - remaining = i18n('message--giftBadge--remaining--days', { + remaining = i18n('icu:message--donation--remaining--days', { days: remainingDays, }); } else if (remainingHours > 1) { - remaining = i18n('message--giftBadge--remaining--hours', { + remaining = i18n('icu:message--donation--remaining--hours', { hours: remainingHours, }); - } else if (remainingMinutes > 1) { - remaining = i18n('message--giftBadge--remaining--minutes', { + } else if (remainingMinutes > 0) { + remaining = i18n('icu:message--donation--remaining--minutes', { minutes: remainingMinutes, }); - } else if (remainingMinutes === 1) { - remaining = i18n('message--giftBadge--remaining--one-minute'); } else { - remaining = i18n('message--giftBadge--expired'); + remaining = i18n('icu:message--donation--expired'); } const wasSent = direction === 'outgoing'; const buttonContents = wasSent ? ( - i18n('message--giftBadge--view') + i18n('icu:message--donation--view') ) : ( <> { `module-message__redeemed-gift-badge__icon-check--${direction}` )} />{' '} - {i18n('message--giftBadge--redeemed')} + {i18n('icu:message--donation--redeemed')} ); @@ -1346,7 +1346,7 @@ export class Message extends React.PureComponent { 'module-message__redeemed-gift-badge__badge', `module-message__redeemed-gift-badge__badge--missing-${direction}` )} - aria-label={i18n('giftBadge--missing')} + aria-label={i18n('icu:donation--missing')} /> ); @@ -1356,7 +1356,7 @@ export class Message extends React.PureComponent { {badgeElement}
- {i18n('message--giftBadge')} + {i18n('icu:message--donation')}
{ let typeLabel; if (isGiftBadge) { - typeLabel = i18n('quote--giftBadge'); + typeLabel = i18n('icu:quote--donation'); } else if (attachment) { const { contentType, isVoiceMessage } = attachment; typeLabel = getTypeLabel({ diff --git a/ts/models/messages.ts b/ts/models/messages.ts index 2dbf7612b260..1a43d6ac954d 100644 --- a/ts/models/messages.ts +++ b/ts/models/messages.ts @@ -814,21 +814,29 @@ export class MessageModel extends window.Backbone.Model { const giftBadge = this.get('giftBadge'); if (giftBadge) { - const emoji = '🎁'; + const emoji = '✨'; + const fromContact = getContact(this.attributes); if (isOutgoing(this.attributes)) { + const recipient = + fromContact?.getTitle() ?? window.i18n('unknownContact'); return { emoji, - text: window.i18n('message--giftBadge--preview--sent'), + text: window.i18n('icu:message--giftBadge--preview--sent', { + recipient, + }), }; } + const sender = fromContact?.getTitle() ?? window.i18n('unknownContact'); return { emoji, text: giftBadge.state === GiftBadgeStates.Unopened - ? window.i18n('message--giftBadge--preview--unopened') - : window.i18n('message--giftBadge--preview--redeemed'), + ? window.i18n('icu:message--giftBadge--preview--unopened', { + sender, + }) + : window.i18n('icu:message--giftBadge--preview--redeemed'), }; } diff --git a/ts/test-electron/state/ducks/conversations_test.ts b/ts/test-electron/state/ducks/conversations_test.ts index e599843dd6ed..d5e48778cfab 100644 --- a/ts/test-electron/state/ducks/conversations_test.ts +++ b/ts/test-electron/state/ducks/conversations_test.ts @@ -1549,7 +1549,7 @@ describe('both/state/ducks/conversations', () => { ...changedMessage, reactions: [ { - emoji: '🎁', + emoji: '✨', fromId: 'some-other-id', timestamp: 2222, targetTimestamp: 1111, @@ -1580,7 +1580,7 @@ describe('both/state/ducks/conversations', () => { ...startState.messagesLookup[messageId], reactions: [ { - emoji: '🎁', + emoji: '✨', fromId: 'some-other-id', timestamp: 2222, targetTimestamp: 1111,