diff options
author | Noritada Kobayashi <noritada.kobayashi@gmail.com> | 2024-01-10 05:53:34 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-10 02:23:34 +0530 |
commit | aeeacd10d322a6e599631c500de03172d69984de (patch) | |
tree | cd110526bb166409c8ddeed9a6e7254f40d0ccc2 | |
parent | 592133db589510115a6ae5c4d9d3c8e391932c77 (diff) | |
download | voidsky-aeeacd10d322a6e599631c500de03172d69984de.tar.zst |
Mark more texts for localization (#2436)
-rw-r--r-- | src/view/com/modals/ContentFilteringSettings.tsx | 36 | ||||
-rw-r--r-- | src/view/com/modals/InviteCodes.tsx | 13 | ||||
-rw-r--r-- | src/view/com/modals/UserAddRemoveLists.tsx | 2 | ||||
-rw-r--r-- | src/view/screens/AppPasswords.tsx | 9 | ||||
-rw-r--r-- | src/view/screens/Settings.tsx | 27 |
5 files changed, 49 insertions, 38 deletions
diff --git a/src/view/com/modals/ContentFilteringSettings.tsx b/src/view/com/modals/ContentFilteringSettings.tsx index 8b42e1b1d..88fb43443 100644 --- a/src/view/com/modals/ContentFilteringSettings.tsx +++ b/src/view/com/modals/ContentFilteringSettings.tsx @@ -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,23 +122,27 @@ 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}> - Adult content can only be enabled via the Web at{' '} - <TextLink - style={pal.link} - href="https://bsky.app" - text="bsky.app" - /> - . + <Trans> + Adult content can only be enabled via the Web at{' '} + <TextLink + style={pal.link} + href="https://bsky.app" + 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} diff --git a/src/view/com/modals/InviteCodes.tsx b/src/view/com/modals/InviteCodes.tsx index 0ebb545cf..a0bb5f4af 100644 --- a/src/view/com/modals/InviteCodes.tsx +++ b/src/view/com/modals/InviteCodes.tsx @@ -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 diff --git a/src/view/com/modals/UserAddRemoveLists.tsx b/src/view/com/modals/UserAddRemoveLists.tsx index c51f862cc..78a3de0b6 100644 --- a/src/view/com/modals/UserAddRemoveLists.tsx +++ b/src/view/com/modals/UserAddRemoveLists.tsx @@ -79,7 +79,7 @@ export function Component({ accessibilityLabel={_(msg`Done`)} accessibilityHint="" onAccessibilityEscape={onPressDone} - label="Done" + label={_(msg`Done`)} /> </View> </View> diff --git a/src/view/screens/AppPasswords.tsx b/src/view/screens/AppPasswords.tsx index 154035f22..ab4a6a6a8 100644 --- a/src/view/screens/AppPasswords.tsx +++ b/src/view/screens/AppPasswords.tsx @@ -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, _]) diff --git a/src/view/screens/Settings.tsx b/src/view/screens/Settings.tsx index 1888cccea..8278b753e 100644 --- a/src/view/screens/Settings.tsx +++ b/src/view/screens/Settings.tsx @@ -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" |