Make valid-i18n-keys rule strict and fix most exceptions
This commit is contained in:
parent
18a6da310f
commit
11cfcb4e32
36 changed files with 796 additions and 687 deletions
|
@ -30,42 +30,64 @@ type PropsHousekeeping = {
|
|||
|
||||
export type Props = PropsData & PropsHousekeeping;
|
||||
|
||||
function UnsupportedMessageContents({ canProcessNow, contact, i18n }: Props) {
|
||||
const { isMe } = contact;
|
||||
const contactName = (
|
||||
<span key="external-1" className="module-unsupported-message__contact">
|
||||
<ContactName
|
||||
title={contact.title}
|
||||
module="module-unsupported-message__contact"
|
||||
/>
|
||||
</span>
|
||||
);
|
||||
if (isMe) {
|
||||
if (canProcessNow) {
|
||||
return (
|
||||
<Intl
|
||||
id="Message--unsupported-message-ask-to-resend"
|
||||
components={{ contact: contactName }}
|
||||
i18n={i18n}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Intl
|
||||
id="Message--from-me-unsupported-message"
|
||||
components={{ contact: contactName }}
|
||||
i18n={i18n}
|
||||
/>
|
||||
);
|
||||
}
|
||||
if (canProcessNow) {
|
||||
return (
|
||||
<Intl
|
||||
id="Message--from-me-unsupported-message-ask-to-resend"
|
||||
components={{ contact: contactName }}
|
||||
i18n={i18n}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Intl
|
||||
id="Message--from-me-unsupported-message"
|
||||
components={{ contact: contactName }}
|
||||
i18n={i18n}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export function UnsupportedMessage({
|
||||
canProcessNow,
|
||||
contact,
|
||||
i18n,
|
||||
}: Props): JSX.Element {
|
||||
const { isMe } = contact;
|
||||
|
||||
const otherStringId = canProcessNow
|
||||
? 'Message--unsupported-message-ask-to-resend'
|
||||
: 'Message--unsupported-message';
|
||||
const meStringId = canProcessNow
|
||||
? 'Message--from-me-unsupported-message-ask-to-resend'
|
||||
: 'Message--from-me-unsupported-message';
|
||||
const stringId = isMe ? meStringId : otherStringId;
|
||||
const icon = canProcessNow ? 'unsupported--can-process' : 'unsupported';
|
||||
|
||||
return (
|
||||
<SystemMessage
|
||||
icon={icon}
|
||||
icon={canProcessNow ? 'unsupported--can-process' : 'unsupported'}
|
||||
contents={
|
||||
// eslint-disable-next-line local-rules/valid-i18n-keys
|
||||
<Intl
|
||||
id={stringId}
|
||||
components={{
|
||||
contact: (
|
||||
<span
|
||||
key="external-1"
|
||||
className="module-unsupported-message__contact"
|
||||
>
|
||||
<ContactName
|
||||
title={contact.title}
|
||||
module="module-unsupported-message__contact"
|
||||
/>
|
||||
</span>
|
||||
),
|
||||
}}
|
||||
<UnsupportedMessageContents
|
||||
canProcessNow={canProcessNow}
|
||||
contact={contact}
|
||||
i18n={i18n}
|
||||
/>
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue