Skip to content

Commit caec051

Browse files
committed
refactor: remove translation function generics after merge
1 parent f4c31e1 commit caec051

File tree

19 files changed

+38
-27
lines changed

19 files changed

+38
-27
lines changed

src/components/Message/MessageThreadReplyInChannelButtonIndicator.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const MessageThreadReplyInChannelButtonIndicator = () => {
2929
})
3030
.catch((error: Error) => {
3131
client.notifications.addError({
32-
message: t<string>('Thread has not been found'),
32+
message: t('Thread has not been found'),
3333
options: {
3434
originalError: error,
3535
type: 'api:message:search:not-found',
@@ -79,7 +79,7 @@ export const MessageThreadReplyInChannelButtonIndicator = () => {
7979
}}
8080
type='button'
8181
>
82-
{t<string>('Thread reply')}
82+
{t('Thread reply')}
8383
</button>
8484
</div>
8585
);

src/components/Message/ReminderNotification.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ export const ReminderNotification = ({ reminder }: ReminderNotificationProps) =>
2626

2727
return (
2828
<p className='str-chat__message-reminder'>
29-
<span>{t<string>('Saved for later')}</span>
29+
<span>{t('Saved for later')}</span>
3030
{reminder?.remindAt && timeLeftMs !== null && (
3131
<>
3232
<span> | </span>
3333
<span>
3434
{isBehindRefreshBoundary
35-
? t<string>('Due since {{ dueSince }}', {
36-
dueSince: t<string>(`timestamp/ReminderNotification`, {
35+
? t('Due since {{ dueSince }}', {
36+
dueSince: t(`timestamp/ReminderNotification`, {
3737
timestamp: reminder.remindAt,
3838
}),
3939
})
40-
: t<string>(`Due {{ timeLeft }}`, {
41-
timeLeft: t<string>('duration/Message reminder', {
40+
: t(`Due {{ timeLeft }}`, {
41+
timeLeft: t('duration/Message reminder', {
4242
milliseconds: timeLeftMs,
4343
}),
4444
})}

src/components/MessageActions/MessageActionsBox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ const UnMemoizedMessageActionsBox = (props: MessageActionsBoxProps) => {
176176
}
177177
role='option'
178178
>
179-
{reminder ? t<string>('Remove reminder') : t<string>('Save for later')}
179+
{reminder ? t('Remove reminder') : t('Save for later')}
180180
</button>
181181
)}
182182
</div>

src/components/MessageActions/RemindMeSubmenu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const RemindMeActionButton = ({
1616
placement={isMine ? 'left-start' : 'right-start'}
1717
Submenu={RemindMeSubmenu}
1818
>
19-
{t<string>('Remind Me')}
19+
{t('Remind Me')}
2020
</ButtonWithSubmenu>
2121
);
2222
};
@@ -42,7 +42,7 @@ export const RemindMeSubmenu = () => {
4242
});
4343
}}
4444
>
45-
{t<string>('duration/Remind Me', { milliseconds: offsetMs })}
45+
{t('duration/Remind Me', { milliseconds: offsetMs })}
4646
</button>
4747
))}
4848
{/* todo: potential improvement to add a custom option that would trigger rendering modal with custom date picker - we need date picker */}

src/components/MessageInput/SendToChannelCheckbox.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ export const SendToChannelCheckbox = () => {
2626
/>
2727
<label htmlFor='send-to-channel-checkbox'>
2828
{Object.keys(messageComposer.channel.state.members).length === 2
29-
? t<string>('Also send as a direct message')
30-
: t<string>('Also send in channel')}
29+
? t('Also send as a direct message')
30+
: t('Also send in channel')}
3131
</label>
3232
</div>
3333
</div>

src/experimental/MessageActions/defaults.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ const DefaultMessageActionComponents = {
137137
: client.reminders.createReminder({ messageId: message.id })
138138
}
139139
>
140-
{reminder ? t<string>('Remove reminder') : t<string>('Save for later')}
140+
{reminder ? t('Remove reminder') : t('Save for later')}
141141
</DefaultDropdownActionButton>
142142
);
143143
},

src/i18n/TranslationBuilder/notifications/NotificationTranslationTopic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class NotificationTranslationTopic extends TranslationTopic<NotificationT
3030
translate = (value: string, key: string, options: { notification?: Notification }) => {
3131
const { notification } = options;
3232
if (!notification) return value;
33-
const translator = notification.code && this.translators.get(notification.code);
33+
const translator = notification.type && this.translators.get(notification.type);
3434
if (!translator) return value;
3535
return translator({ key, options, t: this.i18next.t, value }) || value;
3636
};

src/i18n/__tests__/NotificationTranslationBuilder.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ describe('NotificationTranslationTopic', () => {
4545
translatedString,
4646
);
4747

48-
notification = { code: 'validation:attachment:upload:blocked' };
48+
notification = { type: 'validation:attachment:upload:blocked' };
4949
expect(builder.translate(translatedString, key, { notification })).toBe('blocked');
5050

51-
notification = { code: 'api:attachment:upload:failed' };
51+
notification = { type: 'api:attachment:upload:failed' };
5252
expect(builder.translate(translatedString, key, { notification })).toBe('failed');
5353
});
5454
});

src/i18n/de.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@
181181
"aria/Stop AI Generation": "KI-Generierung stoppen",
182182
"ban-command-args": "[@Benutzername] [Text]",
183183
"ban-command-description": "Einen Benutzer verbannen",
184-
"duration/Remind Me": "duration/Remind Me",
184+
"duration/Message reminder": "{{ milliseconds | durationFormatter(withSuffix: true) }}",
185+
"duration/Remind Me": "{{ milliseconds | durationFormatter(withSuffix: true) }}",
185186
"giphy-command-args": "[Text]",
186187
"giphy-command-description": "Poste ein zufälliges Gif in den Kanal",
187188
"live": "live",

src/i18n/es.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@
184184
"aria/Stop AI Generation": "Detener generación de IA",
185185
"ban-command-args": "[@usuario] [texto]",
186186
"ban-command-description": "Prohibir a un usuario",
187-
"duration/Remind Me": "duration/Remind Me",
187+
"duration/Message reminder": "{{ milliseconds | durationFormatter(withSuffix: true) }}",
188+
"duration/Remind Me": "{{ milliseconds | durationFormatter(withSuffix: true) }}",
188189
"giphy-command-args": "[texto]",
189190
"giphy-command-description": "Publicar un gif aleatorio en el canal",
190191
"live": "En vivo",

0 commit comments

Comments
 (0)