diff --git a/ts/components/emoji/EmojiPicker.tsx b/ts/components/emoji/EmojiPicker.tsx
index 610b3a575524..17189eae481d 100644
--- a/ts/components/emoji/EmojiPicker.tsx
+++ b/ts/components/emoji/EmojiPicker.tsx
@@ -480,7 +480,9 @@ export const EmojiPicker = React.memo(
handlePickTone(event);
}
}}
- title={i18n('EmojiPicker--skin-tone', [`${tone}`])}
+ title={i18n('EmojiPicker--skin-tone', {
+ tone: `${tone}`,
+ })}
className={classNames(
'module-emoji-picker__button',
'module-emoji-picker__button--footer',
diff --git a/ts/components/leftPane/LeftPaneSearchHelper.tsx b/ts/components/leftPane/LeftPaneSearchHelper.tsx
index e16aa937dcfb..309825ab5620 100644
--- a/ts/components/leftPane/LeftPaneSearchHelper.tsx
+++ b/ts/components/leftPane/LeftPaneSearchHelper.tsx
@@ -161,7 +161,11 @@ export class LeftPaneSearchHelper extends LeftPaneHelper
- {i18n('noSearchResults', [searchTerm])}
+
+ {i18n('noSearchResults', {
+ searchTerm,
+ })}
+
{primarySendsSms && (
{i18n('noSearchResults--sms-only')}
diff --git a/ts/groupChange.ts b/ts/groupChange.ts
index f3a0b6fc6d18..73d25c0b41c7 100644
--- a/ts/groupChange.ts
+++ b/ts/groupChange.ts
@@ -14,7 +14,7 @@ export type SmartContactRendererType = (uuid: UUIDStringType) => T | string;
export type StringRendererType = (
id: string,
i18n: LocalizerType,
- components?: Array | ReplacementValuesType
+ components?: ReplacementValuesType
) => T | string;
export type RenderOptionsType = {
@@ -93,7 +93,7 @@ export function renderChangeDetail(
if (newTitle) {
if (fromYou) {
- return renderString('GroupV2--title--change--you', i18n, [newTitle]);
+ return renderString('GroupV2--title--change--you', i18n, { newTitle });
}
if (from) {
return renderString('GroupV2--title--change--other', i18n, {
@@ -101,15 +101,17 @@ export function renderChangeDetail(
newTitle,
});
}
- return renderString('GroupV2--title--change--unknown', i18n, [newTitle]);
+ return renderString('GroupV2--title--change--unknown', i18n, {
+ newTitle,
+ });
}
if (fromYou) {
return renderString('GroupV2--title--remove--you', i18n);
}
if (from) {
- return renderString('GroupV2--title--remove--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--title--remove--other', i18n, {
+ memberName: renderContact(from),
+ });
}
return renderString('GroupV2--title--remove--unknown', i18n);
}
@@ -119,9 +121,9 @@ export function renderChangeDetail(
return renderString('GroupV2--avatar--remove--you', i18n);
}
if (from) {
- return renderString('GroupV2--avatar--remove--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--avatar--remove--other', i18n, {
+ memberName: renderContact(from),
+ });
}
return renderString('GroupV2--avatar--remove--unknown', i18n);
}
@@ -129,9 +131,9 @@ export function renderChangeDetail(
return renderString('GroupV2--avatar--change--you', i18n);
}
if (from) {
- return renderString('GroupV2--avatar--change--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--avatar--change--other', i18n, {
+ memberName: renderContact(from),
+ });
}
return renderString('GroupV2--avatar--change--unknown', i18n);
}
@@ -143,9 +145,9 @@ export function renderChangeDetail(
return renderString('GroupV2--access-attributes--admins--you', i18n);
}
if (from) {
- return renderString('GroupV2--access-attributes--admins--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--access-attributes--admins--other', i18n, {
+ adminName: renderContact(from),
+ });
}
return renderString('GroupV2--access-attributes--admins--unknown', i18n);
}
@@ -154,9 +156,9 @@ export function renderChangeDetail(
return renderString('GroupV2--access-attributes--all--you', i18n);
}
if (from) {
- return renderString('GroupV2--access-attributes--all--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--access-attributes--all--other', i18n, {
+ adminName: renderContact(from),
+ });
}
return renderString('GroupV2--access-attributes--all--unknown', i18n);
}
@@ -173,9 +175,9 @@ export function renderChangeDetail(
return renderString('GroupV2--access-members--admins--you', i18n);
}
if (from) {
- return renderString('GroupV2--access-members--admins--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--access-members--admins--other', i18n, {
+ adminName: renderContact(from),
+ });
}
return renderString('GroupV2--access-members--admins--unknown', i18n);
}
@@ -184,9 +186,9 @@ export function renderChangeDetail(
return renderString('GroupV2--access-members--all--you', i18n);
}
if (from) {
- return renderString('GroupV2--access-members--all--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--access-members--all--other', i18n, {
+ adminName: renderContact(from),
+ });
}
return renderString('GroupV2--access-members--all--unknown', i18n);
}
@@ -206,7 +208,7 @@ export function renderChangeDetail(
return renderString(
'GroupV2--access-invite-link--enabled--other',
i18n,
- [renderContact(from)]
+ { adminName: renderContact(from) }
);
}
return renderString(
@@ -222,7 +224,7 @@ export function renderChangeDetail(
return renderString(
'GroupV2--access-invite-link--disabled--other',
i18n,
- [renderContact(from)]
+ { adminName: renderContact(from) }
);
}
return renderString(
@@ -244,16 +246,16 @@ export function renderChangeDetail(
return renderString('GroupV2--member-add--you--you', i18n);
}
if (from) {
- return renderString('GroupV2--member-add--you--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--member-add--you--other', i18n, {
+ memberName: renderContact(from),
+ });
}
return renderString('GroupV2--member-add--you--unknown', i18n);
}
if (fromYou) {
- return renderString('GroupV2--member-add--other--you', i18n, [
- renderContact(uuid),
- ]);
+ return renderString('GroupV2--member-add--other--you', i18n, {
+ memberName: renderContact(uuid),
+ });
}
if (from) {
return renderString('GroupV2--member-add--other--other', i18n, {
@@ -261,9 +263,9 @@ export function renderChangeDetail(
addeeName: renderContact(uuid),
});
}
- return renderString('GroupV2--member-add--other--unknown', i18n, [
- renderContact(uuid),
- ]);
+ return renderString('GroupV2--member-add--other--unknown', i18n, {
+ memberName: renderContact(uuid),
+ });
}
if (detail.type === 'member-add-from-invite') {
const { uuid, inviter } = detail;
@@ -274,9 +276,9 @@ export function renderChangeDetail(
if (weAreJoiner) {
// They can't be the same, no fromYou check here
if (from) {
- return renderString('GroupV2--member-add--you--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--member-add--you--other', i18n, {
+ memberName: renderContact(from),
+ });
}
return renderString('GroupV2--member-add--you--unknown', i18n);
}
@@ -299,9 +301,9 @@ export function renderChangeDetail(
if (weAreJoiner) {
if (inviter) {
- return renderString('GroupV2--member-add--from-invite--you', i18n, [
- renderContact(inviter),
- ]);
+ return renderString('GroupV2--member-add--from-invite--you', i18n, {
+ inviterName: renderContact(inviter),
+ });
}
return renderString(
'GroupV2--member-add--from-invite--you-no-from',
@@ -309,9 +311,9 @@ export function renderChangeDetail(
);
}
if (weAreInviter) {
- return renderString('GroupV2--member-add--from-invite--from-you', i18n, [
- renderContact(uuid),
- ]);
+ return renderString('GroupV2--member-add--from-invite--from-you', i18n, {
+ inviteeName: renderContact(uuid),
+ });
}
if (inviter) {
return renderString('GroupV2--member-add--from-invite--other', i18n, {
@@ -334,17 +336,17 @@ export function renderChangeDetail(
return renderString('GroupV2--member-add-from-link--you--you', i18n);
}
if (from && uuid === from) {
- return renderString('GroupV2--member-add-from-link--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--member-add-from-link--other', i18n, {
+ memberName: renderContact(from),
+ });
}
// Note: this shouldn't happen, because we only capture 'add-from-link' status
// from group change events, which always have a sender.
log.warn('member-add-from-link change type; we have no from!');
- return renderString('GroupV2--member-add--other--unknown', i18n, [
- renderContact(uuid),
- ]);
+ return renderString('GroupV2--member-add--other--unknown', i18n, {
+ memberName: renderContact(uuid),
+ });
}
if (detail.type === 'member-add-from-admin-approval') {
const { uuid } = detail;
@@ -355,7 +357,7 @@ export function renderChangeDetail(
return renderString(
'GroupV2--member-add-from-admin-approval--you--other',
i18n,
- [renderContact(from)]
+ { adminName: renderContact(from) }
);
}
@@ -374,7 +376,7 @@ export function renderChangeDetail(
return renderString(
'GroupV2--member-add-from-admin-approval--other--you',
i18n,
- [renderContact(uuid)]
+ { joinerName: renderContact(uuid) }
);
}
if (from) {
@@ -394,7 +396,7 @@ export function renderChangeDetail(
return renderString(
'GroupV2--member-add-from-admin-approval--other--unknown',
i18n,
- [renderContact(uuid)]
+ { joinerName: renderContact(uuid) }
);
}
if (detail.type === 'member-remove') {
@@ -406,22 +408,22 @@ export function renderChangeDetail(
return renderString('GroupV2--member-remove--you--you', i18n);
}
if (from) {
- return renderString('GroupV2--member-remove--you--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--member-remove--you--other', i18n, {
+ adminName: renderContact(from),
+ });
}
return renderString('GroupV2--member-remove--you--unknown', i18n);
}
if (fromYou) {
- return renderString('GroupV2--member-remove--other--you', i18n, [
- renderContact(uuid),
- ]);
+ return renderString('GroupV2--member-remove--other--you', i18n, {
+ memberName: renderContact(uuid),
+ });
}
if (from && from === uuid) {
- return renderString('GroupV2--member-remove--other--self', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--member-remove--other--self', i18n, {
+ memberName: renderContact(from),
+ });
}
if (from) {
return renderString('GroupV2--member-remove--other--other', i18n, {
@@ -429,9 +431,9 @@ export function renderChangeDetail(
memberName: renderContact(uuid),
});
}
- return renderString('GroupV2--member-remove--other--unknown', i18n, [
- renderContact(uuid),
- ]);
+ return renderString('GroupV2--member-remove--other--unknown', i18n, {
+ memberName: renderContact(uuid),
+ });
}
if (detail.type === 'member-privilege') {
const { uuid, newPrivilege } = detail;
@@ -443,7 +445,7 @@ export function renderChangeDetail(
return renderString(
'GroupV2--member-privilege--promote--you--other',
i18n,
- [renderContact(from)]
+ { adminName: renderContact(from) }
);
}
@@ -457,7 +459,7 @@ export function renderChangeDetail(
return renderString(
'GroupV2--member-privilege--promote--other--you',
i18n,
- [renderContact(uuid)]
+ { memberName: renderContact(uuid) }
);
}
if (from) {
@@ -473,7 +475,7 @@ export function renderChangeDetail(
return renderString(
'GroupV2--member-privilege--promote--other--unknown',
i18n,
- [renderContact(uuid)]
+ { memberName: renderContact(uuid) }
);
}
if (newPrivilege === RoleEnum.DEFAULT) {
@@ -482,7 +484,7 @@ export function renderChangeDetail(
return renderString(
'GroupV2--member-privilege--demote--you--other',
i18n,
- [renderContact(from)]
+ { adminName: renderContact(from) }
);
}
return renderString(
@@ -495,7 +497,7 @@ export function renderChangeDetail(
return renderString(
'GroupV2--member-privilege--demote--other--you',
i18n,
- [renderContact(uuid)]
+ { memberName: renderContact(uuid) }
);
}
if (from) {
@@ -511,7 +513,7 @@ export function renderChangeDetail(
return renderString(
'GroupV2--member-privilege--demote--other--unknown',
i18n,
- [renderContact(uuid)]
+ { memberName: renderContact(uuid) }
);
}
log.warn(
@@ -524,21 +526,21 @@ export function renderChangeDetail(
const weAreInvited = isOurUuid(uuid);
if (weAreInvited) {
if (from) {
- return renderString('GroupV2--pending-add--one--you--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--pending-add--one--you--other', i18n, {
+ memberName: renderContact(from),
+ });
}
return renderString('GroupV2--pending-add--one--you--unknown', i18n);
}
if (fromYou) {
- return renderString('GroupV2--pending-add--one--other--you', i18n, [
- renderContact(uuid),
- ]);
+ return renderString('GroupV2--pending-add--one--other--you', i18n, {
+ inviteeName: renderContact(uuid),
+ });
}
if (from) {
- return renderString('GroupV2--pending-add--one--other--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--pending-add--one--other--other', i18n, {
+ memberName: renderContact(from),
+ });
}
return renderString('GroupV2--pending-add--one--other--unknown', i18n);
}
@@ -546,9 +548,9 @@ export function renderChangeDetail(
const { count } = detail;
if (fromYou) {
- return renderString('GroupV2--pending-add--many--you', i18n, [
- count.toString(),
- ]);
+ return renderString('GroupV2--pending-add--many--you', i18n, {
+ count: count.toString(),
+ });
}
if (from) {
return renderString('GroupV2--pending-add--many--other', i18n, {
@@ -556,9 +558,9 @@ export function renderChangeDetail(
count: count.toString(),
});
}
- return renderString('GroupV2--pending-add--many--unknown', i18n, [
- count.toString(),
- ]);
+ return renderString('GroupV2--pending-add--many--unknown', i18n, {
+ count: count.toString(),
+ });
}
if (detail.type === 'pending-remove-one') {
const { inviter, uuid } = detail;
@@ -569,15 +571,15 @@ export function renderChangeDetail(
if (weAreInviter) {
if (sentByInvited) {
- return renderString('GroupV2--pending-remove--decline--you', i18n, [
- renderContact(uuid),
- ]);
+ return renderString('GroupV2--pending-remove--decline--you', i18n, {
+ inviteeName: renderContact(uuid),
+ });
}
if (fromYou) {
return renderString(
'GroupV2--pending-remove--revoke-invite-from-you--one--you',
i18n,
- [renderContact(uuid)]
+ { inviteeName: renderContact(uuid) }
);
}
if (from) {
@@ -593,7 +595,7 @@ export function renderChangeDetail(
return renderString(
'GroupV2--pending-remove--revoke-invite-from-you--one--unknown',
i18n,
- [renderContact(uuid)]
+ { inviteeName: renderContact(uuid) }
);
}
if (sentByInvited) {
@@ -601,9 +603,9 @@ export function renderChangeDetail(
return renderString('GroupV2--pending-remove--decline--from-you', i18n);
}
if (inviter) {
- return renderString('GroupV2--pending-remove--decline--other', i18n, [
- renderContact(inviter),
- ]);
+ return renderString('GroupV2--pending-remove--decline--other', i18n, {
+ memberName: renderContact(inviter),
+ });
}
return renderString('GroupV2--pending-remove--decline--unknown', i18n);
}
@@ -612,13 +614,13 @@ export function renderChangeDetail(
return renderString(
'GroupV2--pending-remove--revoke-own--to-you',
i18n,
- [renderContact(inviter)]
+ { inviterName: renderContact(inviter) }
);
}
return renderString(
'GroupV2--pending-remove--revoke-own--unknown',
i18n,
- [renderContact(inviter)]
+ { inviterName: renderContact(inviter) }
);
}
if (inviter) {
@@ -626,7 +628,7 @@ export function renderChangeDetail(
return renderString(
'GroupV2--pending-remove--revoke-invite-from--one--you',
i18n,
- [renderContact(inviter)]
+ { memberName: renderContact(inviter) }
);
}
if (from) {
@@ -642,16 +644,16 @@ export function renderChangeDetail(
return renderString(
'GroupV2--pending-remove--revoke-invite-from--one--unknown',
i18n,
- [renderContact(inviter)]
+ { memberName: renderContact(inviter) }
);
}
if (fromYou) {
return renderString('GroupV2--pending-remove--revoke--one--you', i18n);
}
if (from) {
- return renderString('GroupV2--pending-remove--revoke--one--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--pending-remove--revoke--one--other', i18n, {
+ memberName: renderContact(from),
+ });
}
return renderString('GroupV2--pending-remove--revoke--one--unknown', i18n);
}
@@ -664,7 +666,7 @@ export function renderChangeDetail(
return renderString(
'GroupV2--pending-remove--revoke-invite-from-you--many--you',
i18n,
- [count.toString()]
+ { count: count.toString() }
);
}
if (from) {
@@ -680,7 +682,7 @@ export function renderChangeDetail(
return renderString(
'GroupV2--pending-remove--revoke-invite-from-you--many--unknown',
i18n,
- [count.toString()]
+ { count: count.toString() }
);
}
if (inviter) {
@@ -715,9 +717,9 @@ export function renderChangeDetail(
);
}
if (fromYou) {
- return renderString('GroupV2--pending-remove--revoke--many--you', i18n, [
- count.toString(),
- ]);
+ return renderString('GroupV2--pending-remove--revoke--many--you', i18n, {
+ count: count.toString(),
+ });
}
if (from) {
return renderString(
@@ -732,7 +734,7 @@ export function renderChangeDetail(
return renderString(
'GroupV2--pending-remove--revoke--many--unknown',
i18n,
- [count.toString()]
+ { count: count.toString() }
);
}
if (detail.type === 'admin-approval-add-one') {
@@ -742,9 +744,9 @@ export function renderChangeDetail(
if (weAreJoiner) {
return renderString('GroupV2--admin-approval-add-one--you', i18n);
}
- return renderString('GroupV2--admin-approval-add-one--other', i18n, [
- renderContact(uuid),
- ]);
+ return renderString('GroupV2--admin-approval-add-one--other', i18n, {
+ joinerName: renderContact(uuid),
+ });
}
if (detail.type === 'admin-approval-remove-one') {
const { uuid } = detail;
@@ -767,14 +769,14 @@ export function renderChangeDetail(
return renderString(
'GroupV2--admin-approval-remove-one--other--you',
i18n,
- [renderContact(uuid)]
+ { joinerName: renderContact(uuid) }
);
}
if (from && from === uuid) {
return renderString(
'GroupV2--admin-approval-remove-one--other--own',
i18n,
- [renderContact(uuid)]
+ { joinerName: renderContact(uuid) }
);
}
if (from) {
@@ -793,7 +795,7 @@ export function renderChangeDetail(
return renderString(
'GroupV2--admin-approval-remove-one--other--own',
i18n,
- [renderContact(uuid)]
+ { joinerName: renderContact(uuid) }
);
}
if (detail.type === 'admin-approval-bounce') {
@@ -836,9 +838,9 @@ export function renderChangeDetail(
return renderString('GroupV2--group-link-add--enabled--you', i18n);
}
if (from) {
- return renderString('GroupV2--group-link-add--enabled--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--group-link-add--enabled--other', i18n, {
+ adminName: renderContact(from),
+ });
}
return renderString('GroupV2--group-link-add--enabled--unknown', i18n);
}
@@ -847,9 +849,9 @@ export function renderChangeDetail(
return renderString('GroupV2--group-link-add--disabled--you', i18n);
}
if (from) {
- return renderString('GroupV2--group-link-add--disabled--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--group-link-add--disabled--other', i18n, {
+ adminName: renderContact(from),
+ });
}
return renderString('GroupV2--group-link-add--disabled--unknown', i18n);
}
@@ -861,9 +863,9 @@ export function renderChangeDetail(
return renderString('GroupV2--group-link-reset--you', i18n);
}
if (from) {
- return renderString('GroupV2--group-link-reset--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--group-link-reset--other', i18n, {
+ adminName: renderContact(from),
+ });
}
return renderString('GroupV2--group-link-reset--unknown', i18n);
}
@@ -872,9 +874,9 @@ export function renderChangeDetail(
return renderString('GroupV2--group-link-remove--you', i18n);
}
if (from) {
- return renderString('GroupV2--group-link-remove--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--group-link-remove--other', i18n, {
+ adminName: renderContact(from),
+ });
}
return renderString('GroupV2--group-link-remove--unknown', i18n);
}
@@ -884,9 +886,9 @@ export function renderChangeDetail(
return renderString('GroupV2--description--remove--you', i18n);
}
if (from) {
- return renderString('GroupV2--description--remove--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--description--remove--other', i18n, {
+ memberName: renderContact(from),
+ });
}
return renderString('GroupV2--description--remove--unknown', i18n);
}
@@ -895,9 +897,9 @@ export function renderChangeDetail(
return renderString('GroupV2--description--change--you', i18n);
}
if (from) {
- return renderString('GroupV2--description--change--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--description--change--other', i18n, {
+ memberName: renderContact(from),
+ });
}
return renderString('GroupV2--description--change--unknown', i18n);
}
@@ -907,9 +909,9 @@ export function renderChangeDetail(
return renderString('GroupV2--announcements--admin--you', i18n);
}
if (from) {
- return renderString('GroupV2--announcements--admin--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--announcements--admin--other', i18n, {
+ memberName: renderContact(from),
+ });
}
return renderString('GroupV2--announcements--admin--unknown', i18n);
}
@@ -918,9 +920,9 @@ export function renderChangeDetail(
return renderString('GroupV2--announcements--member--you', i18n);
}
if (from) {
- return renderString('GroupV2--announcements--member--other', i18n, [
- renderContact(from),
- ]);
+ return renderString('GroupV2--announcements--member--other', i18n, {
+ memberName: renderContact(from),
+ });
}
return renderString('GroupV2--announcements--member--unknown', i18n);
}
diff --git a/ts/models/messages.ts b/ts/models/messages.ts
index a44c1f97bc29..7c1edb9e5a48 100644
--- a/ts/models/messages.ts
+++ b/ts/models/messages.ts
@@ -579,7 +579,7 @@ export class MessageModel extends window.Backbone.Model {
renderString: (
key: string,
_i18n: unknown,
- components: Array | ReplacementValuesType | undefined
+ components: ReplacementValuesType | undefined
) => window.i18n(key, components),
});
@@ -640,9 +640,9 @@ export class MessageModel extends window.Backbone.Model {
}
if (groupUpdate.left) {
return {
- text: window.i18n('leftTheGroup', [
- this.getNameForNumber(groupUpdate.left),
- ]),
+ text: window.i18n('leftTheGroup', {
+ name: this.getNameForNumber(groupUpdate.left),
+ }),
};
}
@@ -653,7 +653,11 @@ export class MessageModel extends window.Backbone.Model {
if (isMe(fromContact.attributes)) {
messages.push(window.i18n('youUpdatedTheGroup'));
} else {
- messages.push(window.i18n('updatedTheGroup', [fromContact.getTitle()]));
+ messages.push(
+ window.i18n('updatedTheGroup', {
+ name: fromContact.getTitle(),
+ })
+ );
}
if (groupUpdate.joined && groupUpdate.joined.length) {
@@ -666,9 +670,11 @@ export class MessageModel extends window.Backbone.Model {
if (joinedContacts.length > 1) {
messages.push(
- window.i18n('multipleJoinedTheGroup', [
- joinedWithoutMe.map(contact => contact.getTitle()).join(', '),
- ])
+ window.i18n('multipleJoinedTheGroup', {
+ names: joinedWithoutMe
+ .map(contact => contact.getTitle())
+ .join(', '),
+ })
);
if (joinedWithoutMe.length < joinedContacts.length) {
@@ -683,14 +689,20 @@ export class MessageModel extends window.Backbone.Model {
messages.push(window.i18n('youJoinedTheGroup'));
} else {
messages.push(
- window.i18n('joinedTheGroup', [joinedContacts[0].getTitle()])
+ window.i18n('joinedTheGroup', {
+ name: joinedContacts[0].getTitle(),
+ })
);
}
}
}
if (groupUpdate.name) {
- messages.push(window.i18n('titleIsNow', [groupUpdate.name]));
+ messages.push(
+ window.i18n('titleIsNow', {
+ name: groupUpdate.name,
+ })
+ );
}
if (groupUpdate.avatarUpdated) {
messages.push(window.i18n('updatedGroupAvatar'));
@@ -788,9 +800,9 @@ export class MessageModel extends window.Backbone.Model {
}
return {
- text: window.i18n('timerSetTo', [
- expirationTimer.format(window.i18n, expireTimer),
- ]),
+ text: window.i18n('timerSetTo', {
+ time: expirationTimer.format(window.i18n, expireTimer),
+ }),
};
}
@@ -798,9 +810,9 @@ export class MessageModel extends window.Backbone.Model {
const identifier = this.get('key_changed');
const conversation = window.ConversationController.get(identifier);
return {
- text: window.i18n('safetyNumberChangedGroup', [
- conversation ? conversation.getTitle() : '',
- ]),
+ text: window.i18n('safetyNumberChangedGroup', {
+ name: conversation ? conversation.getTitle() : '',
+ }),
};
}
const contacts = this.get('contact');
diff --git a/ts/services/calling.ts b/ts/services/calling.ts
index 04dc6b9ea0d9..592657b6f1c0 100644
--- a/ts/services/calling.ts
+++ b/ts/services/calling.ts
@@ -2266,9 +2266,9 @@ export class CallingClass {
notificationTitle =
conversation?.getTitle() || FALLBACK_NOTIFICATION_TITLE;
notificationMessage = creatorConversation
- ? window.i18n('calling__call-notification__started', [
- creatorConversation.getTitle(),
- ])
+ ? window.i18n('calling__call-notification__started', {
+ name: creatorConversation.getTitle(),
+ })
: window.i18n('calling__call-notification__started-by-someone');
break;
}
diff --git a/ts/test-both/types/setupI18n_test.ts b/ts/test-both/types/setupI18n_test.ts
index 7360450ae918..40326ad0d631 100644
--- a/ts/test-both/types/setupI18n_test.ts
+++ b/ts/test-both/types/setupI18n_test.ts
@@ -22,7 +22,9 @@ describe('setupI18n', () => {
assert.strictEqual(i18n('reportIssue'), 'Contact Support');
});
it('returns message with single substitution', () => {
- const actual = i18n('migratingToSQLCipher', ['45/200']);
+ const actual = i18n('migratingToSQLCipher', {
+ status: '45/200',
+ });
assert.equal(actual, 'Optimizing messages... 45/200 complete.');
});
it('returns message with multiple substitutions', () => {
diff --git a/ts/types/Util.ts b/ts/types/Util.ts
index 6ac78aa2dcb7..a93772ab3578 100644
--- a/ts/types/Util.ts
+++ b/ts/types/Util.ts
@@ -40,11 +40,9 @@ export type RenderTextCallbackType = (options: {
key: number;
}) => JSX.Element | string;
-export type ReplacementValuesType =
- | Array
- | {
- [key: string]: string | number | undefined;
- };
+export type ReplacementValuesType = {
+ [key: string]: string | number | undefined;
+};
export type LocalizerType = {
(key: string, values?: ReplacementValuesType): string;
diff --git a/ts/util/callingNotification.ts b/ts/util/callingNotification.ts
index 66537ea4db64..eba153d272e6 100644
--- a/ts/util/callingNotification.ts
+++ b/ts/util/callingNotification.ts
@@ -86,9 +86,9 @@ function getGroupCallNotificationText(
if (notification.creator.isMe) {
return i18n('calling__call-notification__started-by-you');
}
- return i18n('calling__call-notification__started', [
- notification.creator.systemGivenName ?? notification.creator.title,
- ]);
+ return i18n('calling__call-notification__started', {
+ name: notification.creator.systemGivenName ?? notification.creator.title,
+ });
}
export function getCallingNotificationText(
diff --git a/ts/util/getMutedUntilText.ts b/ts/util/getMutedUntilText.ts
index c2e00f529841..a8af1cf5a920 100644
--- a/ts/util/getMutedUntilText.ts
+++ b/ts/util/getMutedUntilText.ts
@@ -23,5 +23,7 @@ export function getMutedUntilText(
? expires.format('LT')
: expires.format('L, LT');
- return i18n('muteExpirationLabel', [muteExpirationUntil]);
+ return i18n('muteExpirationLabel', {
+ duration: muteExpirationUntil,
+ });
}
diff --git a/ts/util/timestamp.ts b/ts/util/timestamp.ts
index b7e2ccb43dea..39eaaab598a1 100644
--- a/ts/util/timestamp.ts
+++ b/ts/util/timestamp.ts
@@ -125,21 +125,21 @@ export function formatDateTimeLong(
const timestamp = rawTimestamp.valueOf();
if (isToday(rawTimestamp)) {
- return i18n('timestampFormat__long--today', [
- new Intl.DateTimeFormat(locale, {
+ return i18n('timestampFormat__long--today', {
+ time: new Intl.DateTimeFormat(locale, {
hour: 'numeric',
minute: 'numeric',
}).format(timestamp),
- ]);
+ });
}
if (isYesterday(rawTimestamp)) {
- return i18n('timestampFormat__long--yesterday', [
- new Intl.DateTimeFormat(locale, {
+ return i18n('timestampFormat__long--yesterday', {
+ time: new Intl.DateTimeFormat(locale, {
hour: 'numeric',
minute: 'numeric',
}).format(timestamp),
- ]);
+ });
}
return new Intl.DateTimeFormat(locale, {
@@ -165,11 +165,15 @@ export function formatTime(
}
if (diff < HOUR) {
- return i18n('minutesAgo', [Math.floor(diff / MINUTE).toString()]);
+ return i18n('minutesAgo', {
+ minutes: Math.floor(diff / MINUTE).toString(),
+ });
}
if (isRelativeTime) {
- return i18n('hoursAgo', [Math.floor(diff / HOUR).toString()]);
+ return i18n('hoursAgo', {
+ hours: Math.floor(diff / HOUR).toString(),
+ });
}
return new Date(timestamp).toLocaleTimeString([], {