Skip to content

Commit

Permalink
Don't use the term gift
Browse files Browse the repository at this point in the history
  • Loading branch information
alvaro-signal committed Jan 23, 2023
1 parent 9de33e4 commit ce8a1f5
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 46 deletions.
114 changes: 95 additions & 19 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions ts/components/OutgoingGiftBadgeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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')}
/>
);

Expand All @@ -63,14 +63,14 @@ export function OutgoingGiftBadgeModal({
>
<div className={CLASS_NAME}>
<div className={`${CLASS_NAME}__title`}>
{i18n('modal--giftBadge--title')}
{i18n('icu:modal--donation--title')}
</div>
<div className={`${CLASS_NAME}__description`}>
{i18n('modal--giftBadge--description', { name: recipientTitle })}
{i18n('icu:modal--donation--description', { name: recipientTitle })}
</div>
{badgeElement}
<div className={`${CLASS_NAME}__badge-summary`}>
{i18n('message--giftBadge')}
{i18n('icu:message--donation')}
</div>
</div>
</Modal>
Expand Down
4 changes: 2 additions & 2 deletions ts/components/ToastManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ export function ToastManager({
if (toastType === ToastType.CannotOpenGiftBadgeIncoming) {
return (
<Toast onClose={hideToast}>
{i18n('message--giftBadge--unopened--toast--incoming')}
{i18n('icu:message--donation--unopened--toast--incoming')}
</Toast>
);
}

if (toastType === ToastType.CannotOpenGiftBadgeOutgoing) {
return (
<Toast onClose={hideToast}>
{i18n('message--giftBadge--unopened--toast--outgoing')}
{i18n('icu:message--donation--unopened--toast--outgoing')}
</Toast>
);
}
Expand Down
28 changes: 14 additions & 14 deletions ts/components/conversation/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ export class Message extends React.PureComponent<Props, State> {
}

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) {
Expand Down Expand Up @@ -1228,7 +1228,7 @@ export class Message extends React.PureComponent<Props, State> {
}

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;

Expand All @@ -1239,7 +1239,9 @@ export class Message extends React.PureComponent<Props, State> {
'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,
})}
>
<div
className="module-message__unopened-gift-badge__ribbon-horizontal"
Expand Down Expand Up @@ -1302,26 +1304,24 @@ export class Message extends React.PureComponent<Props, State> {
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')
) : (
<>
<span
Expand All @@ -1330,7 +1330,7 @@ export class Message extends React.PureComponent<Props, State> {
`module-message__redeemed-gift-badge__icon-check--${direction}`
)}
/>{' '}
{i18n('message--giftBadge--redeemed')}
{i18n('icu:message--donation--redeemed')}
</>
);

Expand All @@ -1346,7 +1346,7 @@ export class Message extends React.PureComponent<Props, State> {
'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')}
/>
);

Expand All @@ -1356,7 +1356,7 @@ export class Message extends React.PureComponent<Props, State> {
{badgeElement}
<div className="module-message__redeemed-gift-badge__text">
<div className="module-message__redeemed-gift-badge__title">
{i18n('message--giftBadge')}
{i18n('icu:message--donation')}
</div>
<div
className={classNames(
Expand Down
2 changes: 1 addition & 1 deletion ts/components/conversation/Quote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ export class Quote extends React.Component<Props, State> {
let typeLabel;

if (isGiftBadge) {
typeLabel = i18n('quote--giftBadge');
typeLabel = i18n('icu:quote--donation');
} else if (attachment) {
const { contentType, isVoiceMessage } = attachment;
typeLabel = getTypeLabel({
Expand Down
16 changes: 12 additions & 4 deletions ts/models/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -814,21 +814,29 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {

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'),
};
}

Expand Down
4 changes: 2 additions & 2 deletions ts/test-electron/state/ducks/conversations_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1549,7 +1549,7 @@ describe('both/state/ducks/conversations', () => {
...changedMessage,
reactions: [
{
emoji: '🎁',
emoji: '',
fromId: 'some-other-id',
timestamp: 2222,
targetTimestamp: 1111,
Expand Down Expand Up @@ -1580,7 +1580,7 @@ describe('both/state/ducks/conversations', () => {
...startState.messagesLookup[messageId],
reactions: [
{
emoji: '🎁',
emoji: '',
fromId: 'some-other-id',
timestamp: 2222,
targetTimestamp: 1111,
Expand Down

0 comments on commit ce8a1f5

Please sign in to comment.