Mark more texts for localization (#2436)
parent
592133db58
commit
aeeacd10d3
|
@ -104,6 +104,7 @@ export function Component({}: {}) {
|
||||||
|
|
||||||
function AdultContentEnabledPref() {
|
function AdultContentEnabledPref() {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
|
const {_} = useLingui()
|
||||||
const {data: preferences} = usePreferencesQuery()
|
const {data: preferences} = usePreferencesQuery()
|
||||||
const {mutate, variables} = usePreferencesSetAdultContentMutation()
|
const {mutate, variables} = usePreferencesSetAdultContentMutation()
|
||||||
const {openModal} = useModalControls()
|
const {openModal} = useModalControls()
|
||||||
|
@ -121,23 +122,27 @@ function AdultContentEnabledPref() {
|
||||||
enabled: !(variables?.enabled ?? preferences?.adultContentEnabled),
|
enabled: !(variables?.enabled ?? preferences?.adultContentEnabled),
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Toast.show('There was an issue syncing your preferences with the server')
|
Toast.show(
|
||||||
|
_(msg`There was an issue syncing your preferences with the server`),
|
||||||
|
)
|
||||||
logger.error('Failed to update preferences with server', {error: e})
|
logger.error('Failed to update preferences with server', {error: e})
|
||||||
}
|
}
|
||||||
}, [variables, preferences, mutate])
|
}, [variables, preferences, mutate, _])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={s.mb10}>
|
<View style={s.mb10}>
|
||||||
{isIOS ? (
|
{isIOS ? (
|
||||||
preferences?.adultContentEnabled ? null : (
|
preferences?.adultContentEnabled ? null : (
|
||||||
<Text type="md" style={pal.textLight}>
|
<Text type="md" style={pal.textLight}>
|
||||||
Adult content can only be enabled via the Web at{' '}
|
<Trans>
|
||||||
<TextLink
|
Adult content can only be enabled via the Web at{' '}
|
||||||
style={pal.link}
|
<TextLink
|
||||||
href="https://bsky.app"
|
style={pal.link}
|
||||||
text="bsky.app"
|
href="https://bsky.app"
|
||||||
/>
|
text="bsky.app"
|
||||||
.
|
/>
|
||||||
|
.
|
||||||
|
</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
)
|
)
|
||||||
) : typeof preferences?.birthDate === 'undefined' ? (
|
) : typeof preferences?.birthDate === 'undefined' ? (
|
||||||
|
@ -150,7 +155,7 @@ function AdultContentEnabledPref() {
|
||||||
) : (preferences.userAge || 0) >= 18 ? (
|
) : (preferences.userAge || 0) >= 18 ? (
|
||||||
<ToggleButton
|
<ToggleButton
|
||||||
type="default-light"
|
type="default-light"
|
||||||
label="Enable Adult Content"
|
label={_(msg`Enable Adult Content`)}
|
||||||
isSelected={variables?.enabled ?? preferences?.adultContentEnabled}
|
isSelected={variables?.enabled ?? preferences?.adultContentEnabled}
|
||||||
onPress={onToggleAdultContent}
|
onPress={onToggleAdultContent}
|
||||||
style={styles.toggleBtn}
|
style={styles.toggleBtn}
|
||||||
|
@ -158,7 +163,7 @@ function AdultContentEnabledPref() {
|
||||||
) : (
|
) : (
|
||||||
<View style={[pal.viewLight, styles.agePrompt]}>
|
<View style={[pal.viewLight, styles.agePrompt]}>
|
||||||
<Text type="md" style={[pal.text, {flex: 1}]}>
|
<Text type="md" style={[pal.text, {flex: 1}]}>
|
||||||
You must be 18 or older to enable adult content.
|
<Trans>You must be 18 or older to enable adult content.</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
<Button type="primary" label="Set Age" onPress={onSetAge} />
|
<Button type="primary" label="Set Age" onPress={onSetAge} />
|
||||||
</View>
|
</View>
|
||||||
|
@ -203,7 +208,7 @@ function ContentLabelPref({
|
||||||
|
|
||||||
{disabled || !visibility ? (
|
{disabled || !visibility ? (
|
||||||
<Text type="sm-bold" style={pal.textLight}>
|
<Text type="sm-bold" style={pal.textLight}>
|
||||||
Hide
|
<Trans>Hide</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
) : (
|
) : (
|
||||||
<SelectGroup
|
<SelectGroup
|
||||||
|
@ -223,12 +228,13 @@ interface SelectGroupProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
function SelectGroup({current, onChange, labelGroup}: SelectGroupProps) {
|
function SelectGroup({current, onChange, labelGroup}: SelectGroupProps) {
|
||||||
|
const {_} = useLingui()
|
||||||
return (
|
return (
|
||||||
<View style={styles.selectableBtns}>
|
<View style={styles.selectableBtns}>
|
||||||
<SelectableBtn
|
<SelectableBtn
|
||||||
current={current}
|
current={current}
|
||||||
value="hide"
|
value="hide"
|
||||||
label="Hide"
|
label={_(msg`Hide`)}
|
||||||
left
|
left
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
labelGroup={labelGroup}
|
labelGroup={labelGroup}
|
||||||
|
@ -236,14 +242,14 @@ function SelectGroup({current, onChange, labelGroup}: SelectGroupProps) {
|
||||||
<SelectableBtn
|
<SelectableBtn
|
||||||
current={current}
|
current={current}
|
||||||
value="warn"
|
value="warn"
|
||||||
label="Warn"
|
label={_(msg`Warn`)}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
labelGroup={labelGroup}
|
labelGroup={labelGroup}
|
||||||
/>
|
/>
|
||||||
<SelectableBtn
|
<SelectableBtn
|
||||||
current={current}
|
current={current}
|
||||||
value="ignore"
|
value="ignore"
|
||||||
label="Show"
|
label={_(msg`Show`)}
|
||||||
right
|
right
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
labelGroup={labelGroup}
|
labelGroup={labelGroup}
|
||||||
|
|
|
@ -18,7 +18,8 @@ import {ScrollView} from './util'
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
import {usePalette} from 'lib/hooks/usePalette'
|
||||||
import {isWeb} from 'platform/detection'
|
import {isWeb} from 'platform/detection'
|
||||||
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
||||||
import {Trans} from '@lingui/macro'
|
import {Trans, msg} from '@lingui/macro'
|
||||||
|
import {useLingui} from '@lingui/react'
|
||||||
import {cleanError} from 'lib/strings/errors'
|
import {cleanError} from 'lib/strings/errors'
|
||||||
import {useModalControls} from '#/state/modals'
|
import {useModalControls} from '#/state/modals'
|
||||||
import {useInvitesState, useInvitesAPI} from '#/state/invites'
|
import {useInvitesState, useInvitesAPI} from '#/state/invites'
|
||||||
|
@ -49,6 +50,7 @@ export function Component() {
|
||||||
|
|
||||||
export function Inner({invites}: {invites: InviteCodesQueryResponse}) {
|
export function Inner({invites}: {invites: InviteCodesQueryResponse}) {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
|
const {_} = useLingui()
|
||||||
const {closeModal} = useModalControls()
|
const {closeModal} = useModalControls()
|
||||||
const {isTabletOrDesktop} = useWebMediaQueries()
|
const {isTabletOrDesktop} = useWebMediaQueries()
|
||||||
|
|
||||||
|
@ -75,7 +77,7 @@ export function Inner({invites}: {invites: InviteCodesQueryResponse}) {
|
||||||
]}>
|
]}>
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
label="Done"
|
label={_(msg`Done`)}
|
||||||
style={styles.btn}
|
style={styles.btn}
|
||||||
labelStyle={styles.btnLabel}
|
labelStyle={styles.btnLabel}
|
||||||
onPress={onClose}
|
onPress={onClose}
|
||||||
|
@ -118,7 +120,7 @@ export function Inner({invites}: {invites: InviteCodesQueryResponse}) {
|
||||||
<Button
|
<Button
|
||||||
testID="closeBtn"
|
testID="closeBtn"
|
||||||
type="primary"
|
type="primary"
|
||||||
label="Done"
|
label={_(msg`Done`)}
|
||||||
style={styles.btn}
|
style={styles.btn}
|
||||||
labelStyle={styles.btnLabel}
|
labelStyle={styles.btnLabel}
|
||||||
onPress={onClose}
|
onPress={onClose}
|
||||||
|
@ -140,15 +142,16 @@ function InviteCode({
|
||||||
invites: InviteCodesQueryResponse
|
invites: InviteCodesQueryResponse
|
||||||
}) {
|
}) {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
|
const {_} = useLingui()
|
||||||
const invitesState = useInvitesState()
|
const invitesState = useInvitesState()
|
||||||
const {setInviteCopied} = useInvitesAPI()
|
const {setInviteCopied} = useInvitesAPI()
|
||||||
const uses = invite.uses
|
const uses = invite.uses
|
||||||
|
|
||||||
const onPress = React.useCallback(() => {
|
const onPress = React.useCallback(() => {
|
||||||
Clipboard.setString(invite.code)
|
Clipboard.setString(invite.code)
|
||||||
Toast.show('Copied to clipboard')
|
Toast.show(_(msg`Copied to clipboard`))
|
||||||
setInviteCopied(invite.code)
|
setInviteCopied(invite.code)
|
||||||
}, [setInviteCopied, invite])
|
}, [setInviteCopied, invite, _])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
|
|
|
@ -79,7 +79,7 @@ export function Component({
|
||||||
accessibilityLabel={_(msg`Done`)}
|
accessibilityLabel={_(msg`Done`)}
|
||||||
accessibilityHint=""
|
accessibilityHint=""
|
||||||
onAccessibilityEscape={onPressDone}
|
onAccessibilityEscape={onPressDone}
|
||||||
label="Done"
|
label={_(msg`Done`)}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -33,6 +33,7 @@ import {cleanError} from '#/lib/strings/errors'
|
||||||
type Props = NativeStackScreenProps<CommonNavigatorParams, 'AppPasswords'>
|
type Props = NativeStackScreenProps<CommonNavigatorParams, 'AppPasswords'>
|
||||||
export function AppPasswords({}: Props) {
|
export function AppPasswords({}: Props) {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
|
const {_} = useLingui()
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
const {screen} = useAnalytics()
|
const {screen} = useAnalytics()
|
||||||
const {isTabletOrDesktop} = useWebMediaQueries()
|
const {isTabletOrDesktop} = useWebMediaQueries()
|
||||||
|
@ -98,7 +99,7 @@ export function AppPasswords({}: Props) {
|
||||||
<Button
|
<Button
|
||||||
testID="appPasswordBtn"
|
testID="appPasswordBtn"
|
||||||
type="primary"
|
type="primary"
|
||||||
label="Add App Password"
|
label={_(msg`Add App Password`)}
|
||||||
style={styles.btn}
|
style={styles.btn}
|
||||||
labelStyle={styles.btnLabel}
|
labelStyle={styles.btnLabel}
|
||||||
onPress={onAdd}
|
onPress={onAdd}
|
||||||
|
@ -139,7 +140,7 @@ export function AppPasswords({}: Props) {
|
||||||
<Button
|
<Button
|
||||||
testID="appPasswordBtn"
|
testID="appPasswordBtn"
|
||||||
type="primary"
|
type="primary"
|
||||||
label="Add App Password"
|
label={_(msg`Add App Password`)}
|
||||||
style={styles.btn}
|
style={styles.btn}
|
||||||
labelStyle={styles.btnLabel}
|
labelStyle={styles.btnLabel}
|
||||||
onPress={onAdd}
|
onPress={onAdd}
|
||||||
|
@ -152,7 +153,7 @@ export function AppPasswords({}: Props) {
|
||||||
<Button
|
<Button
|
||||||
testID="appPasswordBtn"
|
testID="appPasswordBtn"
|
||||||
type="primary"
|
type="primary"
|
||||||
label="Add App Password"
|
label={_(msg`Add App Password`)}
|
||||||
style={styles.btn}
|
style={styles.btn}
|
||||||
labelStyle={styles.btnLabel}
|
labelStyle={styles.btnLabel}
|
||||||
onPress={onAdd}
|
onPress={onAdd}
|
||||||
|
@ -224,7 +225,7 @@ function AppPassword({
|
||||||
),
|
),
|
||||||
async onPressConfirm() {
|
async onPressConfirm() {
|
||||||
await deleteMutation.mutateAsync({name})
|
await deleteMutation.mutateAsync({name})
|
||||||
Toast.show('App password deleted')
|
Toast.show(_(msg`App password deleted`))
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}, [deleteMutation, openModal, name, _])
|
}, [deleteMutation, openModal, name, _])
|
||||||
|
|
|
@ -73,6 +73,7 @@ import {useCloseAllActiveElements} from '#/state/util'
|
||||||
|
|
||||||
function SettingsAccountCard({account}: {account: SessionAccount}) {
|
function SettingsAccountCard({account}: {account: SessionAccount}) {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
|
const {_} = useLingui()
|
||||||
const {isSwitchingAccounts, currentAccount} = useSession()
|
const {isSwitchingAccounts, currentAccount} = useSession()
|
||||||
const {logout} = useSessionApi()
|
const {logout} = useSessionApi()
|
||||||
const {data: profile} = useProfileQuery({did: account.did})
|
const {data: profile} = useProfileQuery({did: account.did})
|
||||||
|
@ -98,10 +99,10 @@ function SettingsAccountCard({account}: {account: SessionAccount}) {
|
||||||
testID="signOutBtn"
|
testID="signOutBtn"
|
||||||
onPress={logout}
|
onPress={logout}
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
accessibilityLabel="Sign out"
|
accessibilityLabel={_(msg`Sign out`)}
|
||||||
accessibilityHint={`Signs ${profile?.displayName} out of Bluesky`}>
|
accessibilityHint={`Signs ${profile?.displayName} out of Bluesky`}>
|
||||||
<Text type="lg" style={pal.link}>
|
<Text type="lg" style={pal.link}>
|
||||||
Sign out
|
<Trans>Sign out</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
) : (
|
) : (
|
||||||
|
@ -225,15 +226,15 @@ export function SettingsScreen({}: Props) {
|
||||||
|
|
||||||
const onPressResetOnboarding = React.useCallback(async () => {
|
const onPressResetOnboarding = React.useCallback(async () => {
|
||||||
onboardingDispatch({type: 'start'})
|
onboardingDispatch({type: 'start'})
|
||||||
Toast.show('Onboarding reset')
|
Toast.show(_(msg`Onboarding reset`))
|
||||||
}, [onboardingDispatch])
|
}, [onboardingDispatch, _])
|
||||||
|
|
||||||
const onPressBuildInfo = React.useCallback(() => {
|
const onPressBuildInfo = React.useCallback(() => {
|
||||||
Clipboard.setString(
|
Clipboard.setString(
|
||||||
`Build version: ${AppInfo.appVersion}; Platform: ${Platform.OS}`,
|
`Build version: ${AppInfo.appVersion}; Platform: ${Platform.OS}`,
|
||||||
)
|
)
|
||||||
Toast.show('Copied build version to clipboard')
|
Toast.show(_(msg`Copied build version to clipboard`))
|
||||||
}, [])
|
}, [_])
|
||||||
|
|
||||||
const openHomeFeedPreferences = React.useCallback(() => {
|
const openHomeFeedPreferences = React.useCallback(() => {
|
||||||
navigation.navigate('PreferencesHomeFeed')
|
navigation.navigate('PreferencesHomeFeed')
|
||||||
|
@ -265,12 +266,12 @@ export function SettingsScreen({}: Props) {
|
||||||
|
|
||||||
const clearAllStorage = React.useCallback(async () => {
|
const clearAllStorage = React.useCallback(async () => {
|
||||||
await clearStorage()
|
await clearStorage()
|
||||||
Toast.show(`Storage cleared, you need to restart the app now.`)
|
Toast.show(_(msg`Storage cleared, you need to restart the app now.`))
|
||||||
}, [])
|
}, [_])
|
||||||
const clearAllLegacyStorage = React.useCallback(async () => {
|
const clearAllLegacyStorage = React.useCallback(async () => {
|
||||||
await clearLegacyStorage()
|
await clearLegacyStorage()
|
||||||
Toast.show(`Legacy storage cleared, you need to restart the app now.`)
|
Toast.show(_(msg`Legacy storage cleared, you need to restart the app now.`))
|
||||||
}, [])
|
}, [_])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={s.hContentRegion} testID="settingsScreen">
|
<View style={s.hContentRegion} testID="settingsScreen">
|
||||||
|
@ -449,20 +450,20 @@ export function SettingsScreen({}: Props) {
|
||||||
<View style={[styles.linkCard, pal.view, styles.selectableBtns]}>
|
<View style={[styles.linkCard, pal.view, styles.selectableBtns]}>
|
||||||
<SelectableBtn
|
<SelectableBtn
|
||||||
selected={colorMode === 'system'}
|
selected={colorMode === 'system'}
|
||||||
label="System"
|
label={_(msg`System`)}
|
||||||
left
|
left
|
||||||
onSelect={() => setColorMode('system')}
|
onSelect={() => setColorMode('system')}
|
||||||
accessibilityHint="Set color theme to system setting"
|
accessibilityHint="Set color theme to system setting"
|
||||||
/>
|
/>
|
||||||
<SelectableBtn
|
<SelectableBtn
|
||||||
selected={colorMode === 'light'}
|
selected={colorMode === 'light'}
|
||||||
label="Light"
|
label={_(msg`Light`)}
|
||||||
onSelect={() => setColorMode('light')}
|
onSelect={() => setColorMode('light')}
|
||||||
accessibilityHint="Set color theme to light"
|
accessibilityHint="Set color theme to light"
|
||||||
/>
|
/>
|
||||||
<SelectableBtn
|
<SelectableBtn
|
||||||
selected={colorMode === 'dark'}
|
selected={colorMode === 'dark'}
|
||||||
label="Dark"
|
label={_(msg`Dark`)}
|
||||||
right
|
right
|
||||||
onSelect={() => setColorMode('dark')}
|
onSelect={() => setColorMode('dark')}
|
||||||
accessibilityHint="Set color theme to dark"
|
accessibilityHint="Set color theme to dark"
|
||||||
|
|
Loading…
Reference in New Issue