fix(i18n): review translations and fix i18n library misuse (#2750)

This commit is contained in:
Hampus authored and GitHub committed 2026-09-13 22:58:09 +02:00
1 parent 78f783f0c4
commit 8cb097f954
575 files changed
+192671 -160540

No files matched your search

@@ -104,7 +104,7 @@ const EXPIRE_AFTER_DESCRIPTOR = msg({
comment: 'Label above the expiration duration dropdown in the invite link settings.',
});
const CUSTOM_EXPIRY_SECONDS_DESCRIPTOR = msg({
message: 'Custom expiry (seconds)',
message: 'Custom expiration (seconds)',
comment:
'Label of the numeric input shown after choosing "Custom..." in the invite expiration dropdown. The unit is seconds.',
});
@@ -147,6 +147,24 @@ const INVITE_LINK_HIDDEN_LABEL_DESCRIPTOR = msg({
message: 'Invite link is hidden while sharing:',
comment: 'Label above a masked invite link while streaming privacy is active.',
});
const YOUR_INVITE_LINK_EXPIRES_IN_SECONDS_DESCRIPTOR = msg({
message:
'{seconds, plural, one {Your invite link expires in # second.} other {Your invite link expires in # seconds.}}',
comment: 'Text under a generated invite link. {seconds} is how long the link stays valid, in whole seconds.',
});
const YOUR_INVITE_LINK_EXPIRES_IN_MINUTES_DESCRIPTOR = msg({
message:
'{minutes, plural, one {Your invite link expires in # minute.} other {Your invite link expires in # minutes.}}',
comment: 'Text under a generated invite link. {minutes} is how long the link stays valid, in whole minutes.',
});
const YOUR_INVITE_LINK_EXPIRES_IN_HOURS_DESCRIPTOR = msg({
message: '{hours, plural, one {Your invite link expires in # hour.} other {Your invite link expires in # hours.}}',
comment: 'Text under a generated invite link. {hours} is how long the link stays valid, in whole hours.',
});
const YOUR_INVITE_LINK_EXPIRES_IN_DAYS_DESCRIPTOR = msg({
message: '{days, plural, one {Your invite link expires in # day.} other {Your invite link expires in # days.}}',
comment: 'Text under a generated invite link. {days} is how long the link stays valid, in whole days.',
});
const logger = new Logger('InviteModal');
type InviteModalView = 'recipients' | 'advanced';
@@ -307,11 +325,20 @@ const InviteModalContent = observer(function InviteModalContent({
setShowAdvanced(false);
};
const getExpirationText = () => {
const option = maxAgeOptions.find((opt) => opt.value === maxAge);
if (option) {
return option.label;
const seconds = Number.parseInt(maxAge, 10);
const minutes = seconds / 60;
const hours = minutes / 60;
const days = hours / 24;
if (days >= 1 && days % 1 === 0) {
return i18n._(YOUR_INVITE_LINK_EXPIRES_IN_DAYS_DESCRIPTOR, {days});
}
return maxAge;
if (hours >= 1 && hours % 1 === 0) {
return i18n._(YOUR_INVITE_LINK_EXPIRES_IN_HOURS_DESCRIPTOR, {hours});
}
if (minutes >= 1 && minutes % 1 === 0) {
return i18n._(YOUR_INVITE_LINK_EXPIRES_IN_MINUTES_DESCRIPTOR, {minutes});
}
return i18n._(YOUR_INVITE_LINK_EXPIRES_IN_SECONDS_DESCRIPTOR, {seconds});
};
return (
<Modal.Root size="small" centered data-flx="invite.invite-modal.modal-root--2">
@@ -500,7 +527,7 @@ const InviteModalContent = observer(function InviteModalContent({
</p>
) : (
<p className={styles.expirationText} data-flx="invite.invite-modal.expiration-text--2">
<Trans>Your invite link expires in {getExpirationText()}.</Trans>{' '}
{getExpirationText()}{' '}
<FocusRing offset={-2} data-flx="invite.invite-modal.focus-ring--2">
<button
type="button"