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