chore: disappearing messages string changes

pull/3206/head
Ryan Miller 1 year ago
parent 45eae6e956
commit 87986914c9

@ -47,7 +47,10 @@ function useFollowSettingsButtonClick(
: window.i18n('timerModeSent');
const message = props.disabled
? window.i18n('followSettingDisabled')
: window.i18n('followSettingTimeAndType', [props.timespanText, mode]);
: window.i18n('followSettingTimeAndType', {
time: props.timespanText,
type: mode,
});
const okText = props.disabled ? window.i18n('confirm') : window.i18n('set');
dispatch(
updateConfirmModal({
@ -148,30 +151,43 @@ function useTextToRender(props: PropsForExpirationTimer) {
: window.i18n('timerModeSent');
switch (type) {
case 'fromOther':
return disabled
? window.i18n(
ownSideOnly ? 'theyDisabledTheirDisappearingMessages' : 'disabledDisappearingMessages',
[contact, timespanText]
)
: mode
? window.i18n(ownSideOnly ? 'theySetTheirDisappearingMessages' : 'theyChangedTheTimer', [
contact,
timespanText,
mode,
])
: window.i18n('theyChangedTheTimerLegacy', [contact, timespanText]);
if (disabled) {
return ownSideOnly
? window.i18n('theyDisabledTheirDisappearingMessages', { name: contact })
: window.i18n('disappearingMessagesTurnedOff', { name: contact });
}
if (mode) {
return ownSideOnly
? window.i18n('theySetTheirDisappearingMessages', {
name: contact,
time: timespanText,
type: mode,
})
: window.i18n('theyChangedTheTimer', {
name: contact,
time: timespanText,
// TODO: check this mode
mode: '',
});
}
return window.i18n('theyChangedTheTimerLegacy', { name: contact, time: timespanText });
case 'fromMe':
case 'fromSync':
return disabled
? window.i18n(
ownSideOnly ? 'youDisabledYourDisappearingMessages' : 'youDisabledDisappearingMessages'
)
: mode
? window.i18n(ownSideOnly ? 'youSetYourDisappearingMessages' : 'youChangedTheTimer', [
timespanText,
mode,
])
: window.i18n('youChangedTheTimerLegacy', [timespanText]);
if (disabled) {
return ownSideOnly
? window.i18n('youDisabledYourDisappearingMessages')
: window.i18n('disappearingMessagesTurnedOff', { name: contact });
}
if (mode) {
return ownSideOnly
? window.i18n('youSetYourDisappearingMessages', { time: timespanText, type: mode })
: window.i18n('youChangedTheTimer', { time: timespanText, mode });
}
return window.i18n('youChangedTheTimerLegacy', { time: timespanText });
default:
assertUnreachable(type, `TimerNotification: Missing case error "${type}"`);
}

@ -61,7 +61,7 @@ export const ConversationHeaderTitle = () => {
const { i18n } = window;
const notificationSubtitle = useMemo(
() => (notificationSetting ? i18n('notificationSubtitle', [notificationSetting]) : null),
() => (notificationSetting ? i18n('sessionNotifications') : null),
[i18n, notificationSetting]
);
@ -77,7 +77,7 @@ export const ConversationHeaderTitle = () => {
if (isGroup && memberCount > 0 && !isKickedFromGroup) {
const count = String(memberCount);
return isPublic ? i18n('activeMembers', [count]) : i18n('members', [count]);
return i18n(isPublic ? 'activeMembers' : 'members', { count });
}
return null;

@ -102,22 +102,30 @@ function formatTimeLeft({ timeLeftMs }: { timeLeftMs: number }) {
}
if (timeLeft.isBefore(moment.utc(0).add(1, 'minute'))) {
return window.i18n('messageWillDisappear', [`${timeLeft.seconds()}s`]);
return window.i18n('messageWillDisappear', {
countAndUnit: `${timeLeft.seconds()}s`,
});
}
if (timeLeft.isBefore(moment.utc(0).add(1, 'hour'))) {
const extraUnit = timeLeft.seconds() ? ` ${timeLeft.seconds()}s` : '';
return window.i18n('messageWillDisappear', [`${timeLeft.minutes()}m${extraUnit}`]);
return window.i18n('messageWillDisappear', {
countAndUnit: `${timeLeft.minutes()}m${extraUnit}`,
});
}
if (timeLeft.isBefore(moment.utc(0).add(1, 'day'))) {
const extraUnit = timeLeft.minutes() ? ` ${timeLeft.minutes()}m` : '';
return window.i18n('messageWillDisappear', [`${timeLeft.hours()}h${extraUnit}`]);
return window.i18n('messageWillDisappear', {
countAndUnit: `${timeLeft.hours()}h${extraUnit}`,
});
}
if (timeLeft.isBefore(moment.utc(0).add(7, 'day'))) {
const extraUnit = timeLeft.hours() ? ` ${timeLeft.hours()}h` : '';
return window.i18n('messageWillDisappear', [`${timeLeft.dayOfYear() - 1}d${extraUnit}`]);
return window.i18n('messageWillDisappear', {
countAndUnit: `${timeLeft.dayOfYear() - 1}d${extraUnit}`,
});
}
if (timeLeft.isBefore(moment.utc(0).add(31, 'day'))) {
@ -125,7 +133,7 @@ function formatTimeLeft({ timeLeftMs }: { timeLeftMs: number }) {
const weeks = Math.floor(days / 7);
const daysLeft = days % 7;
const extraUnit = daysLeft ? ` ${daysLeft}d` : '';
return window.i18n('messageWillDisappear', [`${weeks}w${extraUnit}`]);
return window.i18n('messageWillDisappear', { countAndUnit: `${weeks}w${extraUnit}` });
}
return '...';

@ -48,7 +48,7 @@ function getTypeLabel({
return window.i18n('image');
}
if (MIME.isAudio(contentType) && isVoiceMessage) {
return window.i18n('voiceMessage');
return window.i18n('messageVoice');
}
if (MIME.isAudio(contentType)) {
return window.i18n('audio');
@ -75,7 +75,7 @@ export const QuoteText = (
return (
<StyledQuoteText isIncoming={isIncoming} dir="auto">
<MessageBody
text={text || window.i18n('originalMessageNotFound')}
text={text ?? window.i18n('messageErrorOriginal')}
disableLinks={true}
disableJumbomoji={true}
isGroup={isGroup}

@ -173,7 +173,7 @@ const HeaderItem = () => {
{showMemberCount && (
<Flex container={true} flexDirection={'column'}>
<div role="button" className="subtle">
{window.i18n('members', [`${subscriberCount}`])}
{window.i18n('members', { count: `${subscriberCount}` })}
</div>
<SpacerMD />
</Flex>
@ -259,15 +259,15 @@ export const OverlayRightPanelSettings = () => {
const commonNoShow = isKickedFromGroup || left || isBlocked || !isActive;
const hasDisappearingMessages = !isPublic && !commonNoShow;
const leaveGroupString = isPublic
? window.i18n('leaveCommunity')
? window.i18n('communityLeave')
: lastMessage?.interactionType === ConversationInteractionType.Leave &&
lastMessage?.interactionStatus === ConversationInteractionStatus.Error
? window.i18n('deleteConversation')
? window.i18n('conversationsDelete')
: isKickedFromGroup
? window.i18n('youGotKickedFromGroup')
: left
? window.i18n('youLeftTheGroup')
: window.i18n('leaveGroup');
? window.i18n('groupMemberYouLeft')
: window.i18n('groupLeave');
const showUpdateGroupNameButton = isGroup && weAreAdmin && !commonNoShow; // legacy groups non-admin cannot change groupname anymore
const showAddRemoveModeratorsButton = weAreAdmin && !commonNoShow && isPublic;
@ -285,7 +285,7 @@ export const OverlayRightPanelSettings = () => {
{showUpdateGroupNameButton && (
<PanelIconButton
iconType={'group'}
text={isPublic ? window.i18n('editGroup') : window.i18n('editGroupName')}
text={isPublic ? window.i18n('groupEdit') : window.i18n('editGroupName')}
onClick={() => {
void showUpdateGroupNameByConvoId(selectedConvoKey);
}}

@ -208,9 +208,9 @@ export const OverlayDisappearingMessages = () => {
<>
<SpacerLG />
<StyledNonAdminDescription>
{window.i18n('settingAppliesToEveryone')}
{window.i18n('disappearingMessagesDescription')}
<br />
{window.i18n('onlyGroupAdminsCanChange')}
{window.i18n('disappearingMessagesOnlyAdmins')}
</StyledNonAdminDescription>
</>
)}

@ -217,11 +217,11 @@ export const showLinkVisitWarningDialog = (urlToOpen: string, dispatch: Dispatch
dispatch(
updateConfirmModal({
title: window.i18n('linkVisitWarningTitle'),
message: window.i18n('linkVisitWarningMessage', [urlToOpen]),
title: window.i18n('urlOpen'),
message: window.i18n('urlOpenDescription', { url: urlToOpen }),
okText: window.i18n('open'),
okTheme: SessionButtonColor.Primary,
cancelText: window.i18n('editMenuCopy'),
cancelText: window.i18n('copy'),
showExitIcon: true,
onClickOk,
onClickClose: () => {

@ -1681,7 +1681,7 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
const pubkey = this.id;
if (UserUtils.isUsFromCache(pubkey)) {
return window.i18n('you');
return window.i18n('onionRoutingPathYou');
}
const profileName = this.get('displayNameInProfile');
@ -1741,7 +1741,7 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
const isFirstMessageOfConvo =
(await Data.getMessagesByConversation(this.id, { messageId: null })).messages.length === 1;
if (hadNoRequestsPrior && isFirstMessageOfConvo) {
friendRequestText = window.i18n('youHaveANewFriendRequest');
friendRequestText = window.i18n('messageRequestsNew');
} else {
window?.log?.info(
'notification cancelled for as pending requests already exist',
@ -1825,9 +1825,9 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
conversationId,
iconUrl,
isExpiringMessage: false,
message: window.i18n('incomingCallFrom', [
this.getNicknameOrRealUsername() || window.i18n('anonymous'),
]),
message: window.i18n('callsIncoming', {
name: this.getNicknameOrRealUsername() || window.i18n('anonymous'),
}),
messageSentAt: now,
title: this.getNicknameOrRealUsernameOrPlaceholder(),
});

@ -26,14 +26,13 @@ const getCurrentNotificationSettingText = (state: StateType): string | undefined
}
const currentNotificationSetting = getSelectedConversation(state)?.currentNotificationSetting;
switch (currentNotificationSetting) {
case 'all':
return window.i18n('notificationForConvo_all');
case 'mentions_only':
return window.i18n('notificationForConvo_mentions_only');
case 'disabled':
return window.i18n('notificationForConvo_disabled');
default:
return window.i18n('notificationForConvo_all');
return window.i18n('notificationsMentionsOnly');
case 'disabled':
return window.i18n('notificationsMute');
case 'all':
default:
return window.i18n('notificationsAllMessages');
}
};
@ -347,6 +346,7 @@ export function useSelectedShortenedPubkeyOrFallback() {
if (isPrivate) {
return window.i18n('anonymous');
}
// TODO: String localization - remove
return window.i18n('unknown');
}

Loading…
Cancel
Save