Skip to content

Commit 52d3c22

Browse files
Frontend/i18n: Remove inline <Trans> text (#9211)
1 parent 84ff88a commit 52d3c22

21 files changed

Lines changed: 258 additions & 263 deletions

File tree

app/web/components/Navigation/ReportDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export default function ReportDialog({ open, onClose }: DialogProps) {
111111
</StyledLink>
112112
),
113113
}}
114-
></Trans>
114+
/>
115115
</Snackbar>
116116
)}
117117
<Dialog aria-labelledby="bug-reporter" open={open} onClose={handleClose}>

app/web/components/ProfileIncompleteDialog/ProfileIncompleteDialog.tsx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,17 @@ export default function ProfileIncompleteDialog({
4646
</DialogTitle>
4747
<DialogContent>
4848
<DialogContentText>
49-
<Trans i18nKey="profile:complete_profile_dialog.description_1">
50-
Before you can {{ action_name: action_text }}, you must{" "}
51-
<strong>write a bit about yourself</strong> in your profile and{" "}
52-
<strong>upload a profile photo</strong>.
53-
</Trans>
49+
<Trans
50+
i18nKey="profile:complete_profile_dialog.description_1"
51+
values={{ action_name: action_text }}
52+
components={{ 4: <strong />, 7: <strong /> }}
53+
/>
5454
</DialogContentText>
5555
<DialogContentText>
56-
<Trans i18nKey="profile:complete_profile_dialog.description_2">
57-
This helps build a trusted community and reduce spam. For more
58-
information,{" "}
59-
<StyledLink href={howToCompleteProfileUrl}>
60-
please refer to this help page
61-
</StyledLink>
62-
. Thank you for your help!
63-
</Trans>
56+
<Trans
57+
i18nKey="profile:complete_profile_dialog.description_2"
58+
components={{ 2: <StyledLink href={howToCompleteProfileUrl} /> }}
59+
/>
6460
</DialogContentText>
6561
</DialogContent>
6662
<DialogActions>

app/web/features/auth/email/ChangeEmail.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,8 @@ export default function ChangeEmail({ className, email }: ChangeEmailProps) {
7979
<Trans
8080
i18nKey="auth:change_email_form.current_email_message"
8181
values={{ email }}
82-
>
83-
{`Your email address is currently `}
84-
<strong>{email}</strong>
85-
{`.`}
86-
</Trans>
82+
components={{ 1: <strong /> }}
83+
/>
8784
</Typography>
8885
{changeEmailError && (
8986
<Alert severity="error">{changeEmailError.message}</Alert>

app/web/features/auth/phone/ChangePhone.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,7 @@ export default function ChangePhone({
156156
components={{
157157
2: <StyledLink href={howToDonateUrl} />,
158158
}}
159-
>
160-
You need to <StyledLink href={howToDonateUrl}>donate</StyledLink>
161-
before you can complete phone verification.
162-
</Trans>
159+
/>
163160
</Typography>
164161
) : (
165162
<StyledForm onSubmit={onChangeSubmit}>

app/web/features/auth/signup/AccountForm.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,10 @@ export default function AccountForm() {
426426
)}
427427
/>
428428
<Typography variant="body1">
429-
<Trans i18nKey="auth:account_form.tos_prompt">
430-
To continue, please read and accept the <TOSLink />.
431-
</Trans>
429+
<Trans
430+
i18nKey="auth:account_form.tos_prompt"
431+
components={{ 1: <TOSLink /> }}
432+
/>
432433
</Typography>
433434
<FormControlLabel
434435
control={

app/web/features/auth/signup/ResendVerificationEmailForm.tsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,20 @@ export default function ResendVerificationEmailForm() {
3434
</Typography>
3535
<Typography variant="body1">
3636
{!resent ? (
37-
<Trans i18nKey="auth:sign_up_resend_verification_email_help">
38-
Didn't receive the email? Click{" "}
39-
<StyledLink
40-
href="#"
41-
onClick={(e) => {
42-
e.preventDefault();
43-
mutation.mutateAsync();
44-
}}
45-
>
46-
here to resend the verification link
47-
</StyledLink>
48-
.
49-
</Trans>
37+
<Trans
38+
i18nKey="auth:sign_up_resend_verification_email_help"
39+
components={{
40+
2: (
41+
<StyledLink
42+
href="#"
43+
onClick={(e) => {
44+
e.preventDefault();
45+
mutation.mutateAsync();
46+
}}
47+
/>
48+
),
49+
}}
50+
/>
5051
) : (
5152
<>{t("auth:sign_up_resend_verification_done")}</>
5253
)}

app/web/features/auth/signup/Signup.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ export default function Signup() {
180180
<SignupFormContent inviteCode={inviteCode || undefined} />
181181
)}
182182
<Typography sx={{ marginTop: theme.spacing(2) }}>
183-
<Trans i18nKey="auth:basic_sign_up_form.existing_user_prompt">
184-
Already have an account?{" "}
185-
<StyledLink href={loginRoute}>Log in</StyledLink>
186-
</Trans>
183+
<Trans
184+
i18nKey="auth:basic_sign_up_form.existing_user_prompt"
185+
components={{ 2: <StyledLink href={loginRoute} /> }}
186+
/>
187187
</Typography>
188188
</StyledFormWrapper>
189189
</PageContainer>

app/web/features/auth/signup/SignupFormContent.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,19 @@ export default function SignupFormContent({
8181
submitText={t("global:create_account")}
8282
/>
8383
<Typography variant="caption">
84-
<Trans i18nKey="auth:basic_sign_up_form.sign_up_agreement_explainer">
85-
By continuing, you agree to our{" "}
86-
<StyledLink
87-
href={tosRoute}
88-
target={isNativeEmbed ? undefined : "_blank"}
89-
variant="caption"
90-
sx={{ fontWeight: 700 }}
91-
>
92-
Terms of Service
93-
</StyledLink>
94-
, including our cookie, email, and data handling policies.
95-
</Trans>
84+
<Trans
85+
i18nKey="auth:basic_sign_up_form.sign_up_agreement_explainer"
86+
components={{
87+
2: (
88+
<StyledLink
89+
href={tosRoute}
90+
target={isNativeEmbed ? undefined : "_blank"}
91+
variant="caption"
92+
sx={{ fontWeight: 700 }}
93+
/>
94+
),
95+
}}
96+
/>
9697
</Typography>
9798
</>
9899
);

app/web/features/auth/verification/StrongVerificationPage.tsx

Lines changed: 24 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -96,24 +96,13 @@ export default function StrongVerificationInstructions() {
9696
}}
9797
>
9898
<li>
99-
<Trans i18nKey="auth:strong_verification.instructions.before_you_start.nfc_check">
100-
Your phone must have <strong>NFC capability</strong> — most
101-
phones do. Check your phone settings to make sure NFC is turned
102-
on.
103-
</Trans>
99+
<Trans i18nKey="auth:strong_verification.instructions.before_you_start.nfc_check" />
104100
</li>
105101
<li>
106-
<Trans i18nKey="auth:strong_verification.instructions.before_you_start.passport_check">
107-
Your passport must be a <strong>biometric passport</strong>
108-
look for the gold chip symbol on the cover. Older passports
109-
without this symbol won't work.
110-
</Trans>
102+
<Trans i18nKey="auth:strong_verification.instructions.before_you_start.passport_check" />
111103
</li>
112104
<li>
113-
<Trans i18nKey="auth:strong_verification.instructions.before_you_start.remove_case">
114-
<strong>Remove your phone case before starting</strong> — even
115-
thin cases can block the NFC signal and cause the scan to fail.
116-
</Trans>
105+
<Trans i18nKey="auth:strong_verification.instructions.before_you_start.remove_case" />
117106
</li>
118107
</Box>
119108
</Box>
@@ -134,19 +123,14 @@ export default function StrongVerificationInstructions() {
134123
>
135124
<ListItem sx={{ display: "list-item", paddingY: 0.5 }}>
136125
<Typography variant="body1" sx={{ marginBottom: 1 }}>
137-
<Trans i18nKey="auth:strong_verification.instructions.step1">
138-
Download the <strong>IRIS ID</strong> app
139-
</Trans>
126+
<Trans i18nKey="auth:strong_verification.instructions.step1" />
140127
</Typography>
141128
<Typography
142129
variant="body2"
143130
color="text.secondary"
144131
sx={{ marginTop: 1, marginBottom: 1 }}
145132
>
146-
<Trans i18nKey="auth:strong_verification.instructions.step1_apple_note">
147-
<strong>Apple users:</strong> You can skip the download and use
148-
your browser instead. Just click "Open" when prompted.
149-
</Trans>
133+
<Trans i18nKey="auth:strong_verification.instructions.step1_apple_note" />
150134
</Typography>
151135
<Box
152136
sx={{
@@ -187,10 +171,7 @@ export default function StrongVerificationInstructions() {
187171
</ListItem>
188172
<ListItem sx={{ display: "list-item", paddingY: 0.5 }}>
189173
<Typography variant="body1">
190-
<Trans i18nKey="auth:strong_verification.instructions.step2">
191-
Click <strong>"Start Strong Verification"</strong> below (opens
192-
in new tab)
193-
</Trans>
174+
<Trans i18nKey="auth:strong_verification.instructions.step2" />
194175
</Typography>
195176
</ListItem>
196177
<ListItem sx={{ display: "list-item", paddingY: 0.5 }}>
@@ -205,9 +186,7 @@ export default function StrongVerificationInstructions() {
205186
</ListItem>
206187
<ListItem sx={{ display: "list-item", paddingY: 0.5 }}>
207188
<Typography variant="body1">
208-
<Trans i18nKey="auth:strong_verification.instructions.step5">
209-
Select <strong>Passport</strong> (ID cards not supported)
210-
</Trans>
189+
<Trans i18nKey="auth:strong_verification.instructions.step5" />
211190
</Typography>
212191
</ListItem>
213192
<ListItem sx={{ display: "list-item", paddingY: 0.5 }}>
@@ -217,11 +196,7 @@ export default function StrongVerificationInstructions() {
217196
</ListItem>
218197
<ListItem sx={{ display: "list-item", paddingY: 0.5 }}>
219198
<Typography variant="body1">
220-
<Trans i18nKey="auth:strong_verification.instructions.step7">
221-
Hold your phone against the passport page with the NFC chip and
222-
<strong>keep completely still for at least 5 seconds</strong>
223-
moving too early is the most common cause of failure
224-
</Trans>
199+
<Trans i18nKey="auth:strong_verification.instructions.step7" />
225200
</Typography>
226201
</ListItem>
227202
<ListItem sx={{ display: "list-item", paddingY: 0.5 }}>
@@ -269,20 +244,13 @@ export default function StrongVerificationInstructions() {
269244
}}
270245
>
271246
<li>
272-
<Trans i18nKey="auth:strong_verification.instructions.chip_location.us_germany_mexico">
273-
<strong>US, Germany (2016), Mexico:</strong> Back page
274-
</Trans>
247+
<Trans i18nKey="auth:strong_verification.instructions.chip_location.us_germany_mexico" />
275248
</li>
276249
<li>
277-
<Trans i18nKey="auth:strong_verification.instructions.chip_location.finland_germany_new">
278-
<strong>Finland, Germany (2017+):</strong> Picture page
279-
</Trans>
250+
<Trans i18nKey="auth:strong_verification.instructions.chip_location.finland_germany_new" />
280251
</li>
281252
<li>
282-
<Trans i18nKey="auth:strong_verification.instructions.chip_location.australia">
283-
<strong>Australia:</strong> Middle page (marked with symbol +
284-
"chip name")
285-
</Trans>
253+
<Trans i18nKey="auth:strong_verification.instructions.chip_location.australia" />
286254
</li>
287255
</Box>
288256
</Box>
@@ -325,35 +293,19 @@ export default function StrongVerificationInstructions() {
325293
}}
326294
>
327295
<li>
328-
<Trans i18nKey="auth:strong_verification.instructions.scanning_tips.remove_case">
329-
<strong>Remove your phone case</strong> — even thin cases can
330-
block the NFC signal
331-
</Trans>
296+
<Trans i18nKey="auth:strong_verification.instructions.scanning_tips.remove_case" />
332297
</li>
333298
<li>
334-
<Trans i18nKey="auth:strong_verification.instructions.scanning_tips.hold_still">
335-
<strong>Hold your phone completely still</strong> for at least 5
336-
seconds — moving too early is the most common cause of failure
337-
</Trans>
299+
<Trans i18nKey="auth:strong_verification.instructions.scanning_tips.hold_still" />
338300
</li>
339301
<li>
340-
<Trans i18nKey="auth:strong_verification.instructions.scanning_tips.flat_surface">
341-
<strong>Place your passport on a flat surface</strong> — don't
342-
hold it in your hand
343-
</Trans>
302+
<Trans i18nKey="auth:strong_verification.instructions.scanning_tips.flat_surface" />
344303
</li>
345304
<li>
346-
<Trans i18nKey="auth:strong_verification.instructions.scanning_tips.nfc_location">
347-
<strong>Find your phone's NFC antenna</strong> — it's usually
348-
near the top-center on the back of the phone. Try different
349-
positions if it doesn't connect
350-
</Trans>
305+
<Trans i18nKey="auth:strong_verification.instructions.scanning_tips.nfc_location" />
351306
</li>
352307
<li>
353-
<Trans i18nKey="auth:strong_verification.instructions.scanning_tips.no_metal">
354-
<strong>Avoid metal surfaces</strong> — don't place your
355-
passport on a metal table or laptop
356-
</Trans>
308+
<Trans i18nKey="auth:strong_verification.instructions.scanning_tips.no_metal" />
357309
</li>
358310
<li>
359311
{t("auth:strong_verification.instructions.scanning_tips.retry")}
@@ -388,13 +340,14 @@ export default function StrongVerificationInstructions() {
388340
</li>
389341
</Box>
390342
<Typography variant="body1">
391-
<Trans i18nKey="auth:strong_verification.instructions.didnt_work.contact">
392-
If you're still having trouble,
393-
<StyledLink href="mailto:support@couchers.org?subject=Strong%20Verification%20Help">
394-
let us know
395-
</StyledLink>
396-
and we'll help.
397-
</Trans>
343+
<Trans
344+
i18nKey="auth:strong_verification.instructions.didnt_work.contact"
345+
components={{
346+
1: (
347+
<StyledLink href="mailto:support@couchers.org?subject=Strong%20Verification%20Help" />
348+
),
349+
}}
350+
/>
398351
</Typography>
399352
</Box>
400353

app/web/features/communities/CommunitiesPage/CommunitiesPage.tsx

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,19 @@ const CommunitiesPage = () => {
9191
<Trans i18nKey="dashboard:communities_intro" />
9292
</StyledTypography>
9393
<StyledTypography variant="body1" paragraph>
94-
<Trans i18nKey="dashboard:community_builder">
95-
{`Want to be an ambassador for your community and help it grow? Become a `}
96-
<MuiLink
97-
href={helpCenterCommunityBuilderURL}
98-
target="_blank"
99-
rel="noreferrer noopener"
100-
underline="hover"
101-
>
102-
Community Builder!
103-
</MuiLink>
104-
</Trans>
94+
<Trans
95+
i18nKey="dashboard:community_builder"
96+
components={{
97+
1: (
98+
<MuiLink
99+
href={helpCenterCommunityBuilderURL}
100+
target="_blank"
101+
rel="noreferrer noopener"
102+
underline="hover"
103+
/>
104+
),
105+
}}
106+
/>
105107
</StyledTypography>
106108

107109
<MainTitle variant="h1">
@@ -112,17 +114,19 @@ const CommunitiesPage = () => {
112114
<MainTitle variant="h1">{t("dashboard:find_your_community")}</MainTitle>
113115

114116
<StyledTypography variant="body1" paragraph>
115-
<Trans i18nKey="dashboard:find_your_community_intro_simplified">
116-
{`Search for your community or browse below. `}
117-
<MuiLink
118-
href={communityCreationFormURL(accountInfo?.username)}
119-
target="_blank"
120-
rel="noreferrer noopener"
121-
underline="hover"
122-
>
123-
Don't see yours? Request it!
124-
</MuiLink>
125-
</Trans>
117+
<Trans
118+
i18nKey="dashboard:find_your_community_intro_simplified"
119+
components={{
120+
1: (
121+
<MuiLink
122+
href={communityCreationFormURL(accountInfo?.username)}
123+
target="_blank"
124+
rel="noreferrer noopener"
125+
underline="hover"
126+
/>
127+
),
128+
}}
129+
/>
126130
</StyledTypography>
127131

128132
<NewCommunities />

0 commit comments

Comments
 (0)