Skip to content

Commit e058211

Browse files
committed
chore: renamed all localize calls to their tr equivalents
1 parent 2bf00c4 commit e058211

File tree

91 files changed

+485
-592
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+485
-592
lines changed

ts/components/AboutView.tsx

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { themeStore } from '../state/theme/store';
1010
import { SessionButton, SessionButtonType } from './basic/SessionButton';
1111
import { Localizer } from './basic/Localizer';
1212
import { CopyToClipboardButton } from './buttons';
13-
import { localize } from '../localization/localeTools';
13+
import { tr } from '../localization/localeTools';
1414

1515
const StyledContent = styled(Flex)`
1616
background-color: var(--background-primary-color);
@@ -60,18 +60,13 @@ export const AboutView = () => {
6060
}
6161

6262
const version = window.getVersion();
63-
const versionInfo = localize('updateVersion').withArgs({ version }).toString();
64-
const systemInfo = localize('systemInformationDesktop')
65-
.withArgs({
66-
information: window.getOSRelease(),
67-
})
68-
.toString();
69-
const commitInfo = localize('commitHashDesktop')
70-
.withArgs({
71-
hash: window.getCommitHash() || localize('unknown').toString(),
72-
})
73-
.toString();
74-
63+
const versionInfo = tr('updateVersion', { version });
64+
const systemInfo = tr('systemInformationDesktop', {
65+
information: window.getOSRelease(),
66+
});
67+
const commitInfo = tr('commitHashDesktop', {
68+
hash: window.getCommitHash() || tr('unknown'),
69+
});
7570
useEffect(() => {
7671
if (window.theme) {
7772
void switchThemeTo({

ts/components/MemberListItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {
3333
} from '../webworker/workers/browser/libsession_worker_interface';
3434
import { assertUnreachable } from '../types/sqlSharedTypes';
3535
import { isUsAnySogsFromCache } from '../session/apis/open_group_api/sogsv3/knownBlindedkeys';
36-
import { localize, tr } from '../localization/localeTools';
36+
import { tr } from '../localization/localeTools';
3737

3838
const AvatarContainer = styled.div`
3939
position: relative;
@@ -342,7 +342,7 @@ export const MemberListItem = <T extends string>({
342342
}: MemberListItemProps<T>) => {
343343
const memberName = useNicknameOrProfileNameOrShortenedPubkey(pubkey);
344344
const isYou = isUsAnySogsFromCache(pubkey);
345-
const ourName = isYou ? localize('you').toString() : null;
345+
const ourName = isYou ? tr('you') : null;
346346
const shortPubkey = PubKey.shorten(pubkey);
347347
const nameSuffix =
348348
isPublic && inMentions && !isYou && memberName !== shortPubkey ? shortPubkey : '';

ts/components/SessionPasswordPrompt.tsx

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { SessionToastContainer } from './SessionToastContainer';
1212
import { SessionToast } from './basic/SessionToast';
1313
import { SessionSpinner } from './loading';
1414
import { Localizer } from './basic/Localizer';
15-
import { localize } from '../localization/localeTools';
15+
import { tr } from '../localization/localeTools';
1616
import {
1717
ModalBasicHeader,
1818
ModalActionsContainer,
@@ -58,16 +58,12 @@ function ClearDataViewButtons({ onCancel }: { onCancel: () => void }) {
5858
return (
5959
<ModalActionsContainer>
6060
<SessionButton
61-
text={localize('clearDevice').toString()}
61+
text={tr('clearDevice')}
6262
buttonColor={SessionButtonColor.Danger}
6363
buttonType={SessionButtonType.Simple}
6464
onClick={window.clearLocalData}
6565
/>
66-
<SessionButton
67-
text={localize('cancel').toString()}
68-
buttonType={SessionButtonType.Simple}
69-
onClick={onCancel}
70-
/>
66+
<SessionButton text={tr('cancel')} buttonType={SessionButtonType.Simple} onClick={onCancel} />
7167
</ModalActionsContainer>
7268
);
7369
}
@@ -93,15 +89,15 @@ function PasswordViewButtons({
9389
<ModalActionsContainer>
9490
{showResetElements && (
9591
<SessionButton
96-
text={localize('clearDevice').toString()}
92+
text={tr('clearDevice')}
9793
buttonColor={SessionButtonColor.Danger}
9894
buttonType={SessionButtonType.Simple}
9995
onClick={onShowClearDataView}
10096
/>
10197
)}
10298
{!loading && (
10399
<SessionButton
104-
text={showResetElements ? localize('tryAgain').toString() : localize('done').toString()}
100+
text={showResetElements ? tr('tryAgain') : tr('done')}
105101
buttonType={SessionButtonType.Simple}
106102
onClick={initLogin}
107103
disabled={loading}
@@ -148,7 +144,7 @@ const PasswordPrompt = ({
148144
}) => {
149145
return (
150146
<ShowHideSessionInput
151-
placeholder={localize('passwordEnter').toString()}
147+
placeholder={tr('passwordEnter')}
152148
onEnterPressed={onEnterPressed}
153149
onValueChanged={onPasswordChange}
154150
ariaLabel="password input"
@@ -194,9 +190,7 @@ const SessionPasswordPromptInner = () => {
194190
return (
195191
<SessionWrapperModal
196192
headerChildren={
197-
<ModalBasicHeader
198-
title={localize(clearDataView ? 'clearDevice' : 'passwordEnter').toString()}
199-
/>
193+
<ModalBasicHeader title={tr(clearDataView ? 'clearDevice' : 'passwordEnter')} />
200194
}
201195
$contentMinWidth={WrapperModalWidth.narrow}
202196
buttonChildren={

ts/components/SessionSearchInput.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { searchActions, type DoSearchActionType, type SearchType } from '../stat
77
import { getConversationsCount } from '../state/selectors/conversations';
88
import { useLeftOverlayMode } from '../state/selectors/section';
99
import { useHotkey } from '../hooks/useHotkey';
10-
import { localize } from '../localization/localeTools';
10+
import { tr } from '../localization/localeTools';
1111
import { SessionLucideIconButton } from './icon/SessionIconButton';
1212
import { LUCIDE_ICONS_UNICODE } from './icon/lucide';
1313
import { LucideIcon } from './icon/LucideIcon';
@@ -84,9 +84,7 @@ export const SessionSearchInput = ({ searchType }: { searchType: SearchType }) =
8484

8585
const iconSize = 'medium';
8686

87-
const placeholder = isGroupCreationSearch
88-
? localize('searchContacts').toString()
89-
: localize('search').toString();
87+
const placeholder = isGroupCreationSearch ? tr('searchContacts') : tr('search');
9088

9189
const isInMainScreen = searchType === 'global' || searchType === 'create-group';
9290

ts/components/buttons/MenuButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useLeftOverlayMode } from '../../state/selectors/section';
44
import { sectionActions } from '../../state/ducks/section';
55
import { searchActions } from '../../state/ducks/search';
66
import { LucideIcon } from '../icon/LucideIcon';
7-
import { localize } from '../../localization/localeTools';
7+
import { tr } from '../../localization/localeTools';
88
import { LUCIDE_ICONS_UNICODE } from '../icon/lucide';
99

1010
const StyledMenuButton = styled.button`
@@ -57,7 +57,7 @@ export const MenuButton = () => {
5757
<LucideIcon
5858
unicode={LUCIDE_ICONS_UNICODE.PLUS}
5959
iconSize="large"
60-
aria-label={localize('contentDescriptionChooseConversationType')}
60+
aria-label={tr('contentDescriptionChooseConversationType')}
6161
/>
6262
</StyledMenuButton>
6363
);

ts/components/calling/IncomingCallDialog.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { callTimeoutMs } from '../../session/utils/calling/CallManager';
99
import { getHasIncomingCall, getHasIncomingCallFrom } from '../../state/selectors/call';
1010
import { Avatar, AvatarSize } from '../avatar/Avatar';
1111
import { SessionButton, SessionButtonColor, SessionButtonType } from '../basic/SessionButton';
12-
import { localize } from '../../localization/localeTools';
12+
import { tr } from '../../localization/localeTools';
1313
import {
1414
ModalBasicHeader,
1515
ModalActionsContainer,
@@ -84,23 +84,19 @@ export const IncomingCallDialog = () => {
8484
<SessionWrapperModal
8585
headerChildren={
8686
<ModalBasicHeader
87-
title={localize('callsIncoming')
88-
.withArgs({
89-
name: from ?? localize('unknown').toString(),
90-
})
91-
.toString()}
87+
title={tr('callsIncoming', { name: from ?? tr('unknown').toString() })}
9288
/>
9389
}
9490
buttonChildren={
9591
<ModalActionsContainer>
9692
<SessionButton
97-
text={localize('accept').toString()}
93+
text={tr('accept').toString()}
9894
buttonType={SessionButtonType.Simple}
9995
onClick={handleAcceptIncomingCall}
10096
buttonColor={SessionButtonColor.Danger}
10197
/>
10298
<SessionButton
103-
text={localize('decline').toString()}
99+
text={tr('decline').toString()}
104100
buttonType={SessionButtonType.Simple}
105101
onClick={handleDeclineIncomingCall}
106102
/>

ts/components/conversation/AddMentions.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ConvoHub } from '../../session/conversations';
44
import { isUsAnySogsFromCache } from '../../session/apis/open_group_api/sogsv3/knownBlindedkeys';
55
import { PubKey } from '../../session/types';
66
import { RenderTextCallbackType } from '../../types/Util';
7-
import { localize } from '../../localization/localeTools';
7+
import { tr } from '../../localization/localeTools';
88

99
interface MentionProps {
1010
key: string;
@@ -42,7 +42,7 @@ export const Mention = (props: MentionProps) => {
4242
contentEditable={false}
4343
inComposableElement={props.inComposableElement}
4444
>
45-
@{localize('you')}
45+
@{tr('you')}
4646
{props.children}
4747
</StyledMentionedUs>
4848
);

ts/components/conversation/ContactName.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
import { Emojify } from './Emojify';
99
import { PubKey } from '../../session/types';
1010
import { UserUtils } from '../../session/utils';
11-
import { localize } from '../../localization/localeTools';
11+
import { tr } from '../../localization/localeTools';
1212

1313
type Props = {
1414
pubkey: string;
@@ -69,7 +69,7 @@ export const ContactName = (props: Props) => {
6969
{shouldShowProfile ? (
7070
<div style={styles} className={`${prefix}__profile-name`}>
7171
<Emojify
72-
text={isYou ? localize('you').toString() : displayedName}
72+
text={isYou ? tr('you').toString() : displayedName}
7373
sizeClass="small"
7474
isGroup={!isPrivate}
7575
/>

ts/components/conversation/SessionConversation.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import { showLinkVisitWarningDialog } from '../dialog/OpenUrlModal';
6161
import { InvitedToGroup, NoMessageInConversation } from './SubtleNotification';
6262
import { PubKey } from '../../session/types';
6363
import { isUsAnySogsFromCache } from '../../session/apis/open_group_api/sogsv3/knownBlindedkeys';
64-
import { localize } from '../../localization/localeTools';
64+
import { tr } from '../../localization/localeTools';
6565
import {
6666
useConversationIsExpired03Group,
6767
useSelectedConversationKey,
@@ -115,7 +115,7 @@ const GroupMarkedAsExpired = () => {
115115
}
116116
return (
117117
<NoticeBanner
118-
text={localize('groupNotUpdatedWarning').toString()}
118+
text={tr('groupNotUpdatedWarning')}
119119
dataTestId="group-not-updated-30-days-banner"
120120
/>
121121
);
@@ -227,10 +227,10 @@ export class SessionConversation extends Component<Props, State> {
227227
if (msg.body.replace(/\s/g, '').includes(recoveryPhrase.replace(/\s/g, ''))) {
228228
window.inboxStore?.dispatch(
229229
updateConfirmModal({
230-
title: localize('warning').toString(),
230+
title: tr('warning'),
231231
i18nMessage: { token: 'recoveryPasswordWarningSendDescription' },
232232
okTheme: SessionButtonColor.Danger,
233-
okText: localize('send').toString(),
233+
okText: tr('send'),
234234
onClickOk: () => {
235235
void sendAndScroll();
236236
},
@@ -546,7 +546,7 @@ export class SessionConversation extends Component<Props, State> {
546546
return {
547547
id: pubKey,
548548
display: isUsAnySogsFromCache(pubKey)
549-
? localize('you').toString()
549+
? tr('you')
550550
: ConvoHub.use().get(pubKey)?.getNicknameOrRealUsernameOrPlaceholder() ||
551551
PubKey.shorten(pubKey),
552552
};
@@ -663,9 +663,9 @@ function OutdatedLegacyGroupBanner() {
663663
selectedConversationKey &&
664664
PubKey.is05Pubkey(selectedConversationKey);
665665

666-
const text = localize(
666+
const text = tr(
667667
weAreAdmin ? 'legacyGroupAfterDeprecationAdmin' : 'legacyGroupAfterDeprecationMember'
668-
).toString();
668+
);
669669

670670
return isLegacyGroup ? (
671671
<NoticeBanner

ts/components/conversation/SessionQuotedMessageComposition.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { GoogleChrome } from '../../util';
1515
import { SessionLucideIconButton } from '../icon/SessionIconButton';
1616
import { LUCIDE_ICONS_UNICODE } from '../icon/lucide';
1717
import { LucideIcon } from '../icon/LucideIcon';
18-
import { localize } from '../../localization/localeTools';
18+
import { tr } from '../../localization/localeTools';
1919
import { ContactName } from './ContactName';
2020
import { useSelectedIsPublic } from '../../state/selectors/selectedConversation';
2121
import { QuoteText } from './message/message-content/quote/QuoteText';
@@ -102,7 +102,7 @@ export const SessionQuotedMessageComposition = () => {
102102
/** isIncoming must be true here otherwise the text content is the same color as the background */
103103
<QuoteText isIncoming={true} text={quoteText} referencedMessageNotFound={true} />
104104
) : (
105-
localize(
105+
tr(
106106
hasAudioAttachment
107107
? 'audio'
108108
: isGenericFile
@@ -170,7 +170,7 @@ export const SessionQuotedMessageComposition = () => {
170170
iconSize="medium"
171171
onClick={removeQuotedMessage}
172172
margin={'0 var(--margins-sm) 0 0'}
173-
aria-label={localize('close').toString()}
173+
aria-label={tr('close')}
174174
dataTestId="link-preview-close"
175175
/>
176176
</QuotedMessageComposition>

0 commit comments

Comments
 (0)