Improve localization of {els} string on Create Account page (#3912)

Co-authored-by: Hailey <me@haileyok.com>
This commit is contained in:
Minseo Lee
2024-10-06 08:22:00 +09:00
committed by GitHub
parent 1118fd6883
commit 25e3c93e1e
2 changed files with 55 additions and 33 deletions
+43 -22
View File
@@ -1,4 +1,4 @@
import React from 'react' import React, {ReactElement} from 'react'
import {View} from 'react-native' import {View} from 'react-native'
import {ComAtprotoServerDescribeServer} from '@atproto/api' import {ComAtprotoServerDescribeServer} from '@atproto/api'
import {msg, Trans} from '@lingui/macro' import {msg, Trans} from '@lingui/macro'
@@ -42,43 +42,64 @@ export const Policies = ({
) )
} }
const els = [] let els: ReactElement
if (tos) { if (tos && pp) {
els.push( els = (
<Trans>
By creating an account you agree to the{' '}
<InlineLinkText <InlineLinkText
label={_(msg`Read the Bluesky Terms of Service`)} label={_(msg`Read the Bluesky Terms of Service`)}
key="tos" key="tos"
to={tos}> to={tos}>
{_(msg`Terms of Service`)} Terms of Service
</InlineLinkText>, </InlineLinkText>{' '}
) and{' '}
}
if (pp) {
els.push(
<InlineLinkText <InlineLinkText
label={_(msg`Read the Bluesky Privacy Policy`)} label={_(msg`Read the Bluesky Privacy Policy`)}
key="pp" key="pp"
to={pp}> to={pp}>
{_(msg`Privacy Policy`)} Privacy Policy
</InlineLinkText>, </InlineLinkText>
.
</Trans>
) )
} } else if (tos) {
if (els.length === 2) { els = (
els.splice( <Trans>
1, By creating an account you agree to the{' '}
0, <InlineLinkText
<Text key="and" style={[t.atoms.text_contrast_medium]}> label={_(msg`Read the Bluesky Terms of Service`)}
{' '} key="tos"
and{' '} to={tos}>
</Text>, Terms of Service
</InlineLinkText>
.
</Trans>
) )
} else if (pp) {
els = (
<Trans>
By creating an account you agree to the{' '}
<InlineLinkText
label={_(msg`Read the Bluesky Privacy Policy`)}
key="pp"
to={pp}>
Privacy Policy
</InlineLinkText>
.
</Trans>
)
} else {
return null
} }
return ( return (
<View style={[a.gap_sm]}> <View style={[a.gap_sm]}>
{els ? (
<Text style={[a.leading_snug, t.atoms.text_contrast_medium]}> <Text style={[a.leading_snug, t.atoms.text_contrast_medium]}>
<Trans>By creating an account you agree to the {els}.</Trans> {els}
</Text> </Text>
) : null}
{under13 ? ( {under13 ? (
<Text style={[a.font_bold, a.leading_snug, t.atoms.text_contrast_high]}> <Text style={[a.font_bold, a.leading_snug, t.atoms.text_contrast_high]}>
+2 -1
View File
@@ -168,7 +168,8 @@ export function Signup({onPressBack}: {onPressBack: () => void}) {
<View <View
style={[a.w_full, a.py_lg, a.flex_row, a.gap_lg, a.align_center]}> style={[a.w_full, a.py_lg, a.flex_row, a.gap_lg, a.align_center]}>
<AppLanguageDropdown /> <AppLanguageDropdown />
<Text style={[t.atoms.text, !gtMobile && a.text_md]}> <Text
style={[t.atoms.text_contrast_medium, !gtMobile && a.text_md]}>
<Trans>Having trouble?</Trans>{' '} <Trans>Having trouble?</Trans>{' '}
<InlineLinkText <InlineLinkText
label={_(msg`Contact support`)} label={_(msg`Contact support`)}