diff --git a/src/ageAssurance/components/RedirectOverlay.tsx b/src/ageAssurance/components/RedirectOverlay.tsx index 5a6f5b2934..9a71649e4c 100644 --- a/src/ageAssurance/components/RedirectOverlay.tsx +++ b/src/ageAssurance/components/RedirectOverlay.tsx @@ -9,8 +9,7 @@ import { } from 'react' import {Dimensions, View} from 'react-native' import * as Linking from 'expo-linking' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {retry} from '#/lib/async/retry' @@ -132,7 +131,7 @@ export function Provider({children}: {children?: React.ReactNode}) { export function RedirectOverlay() { const t = useTheme() - const {_} = useLingui() + const {t: l} = useLingui() const {isOpen} = useRedirectOverlayContext() const {gtMobile} = useBreakpoints() @@ -162,7 +161,7 @@ export function RedirectOverlay() { + aria-label={l`Verifying your age assurance status`}> @@ -175,7 +174,7 @@ export function RedirectOverlay() { function Inner() { const t = useTheme() const ax = useAnalytics() - const {_} = useLingui() + const {t: l} = useLingui() const agent = useAgent() const polling = useRef(false) const unmounted = useRef(false) @@ -262,7 +261,7 @@ function Inner() { diff --git a/src/components/FocusScope/index.tsx b/src/components/FocusScope/index.tsx index 48e013500e..54c61ab40a 100644 --- a/src/components/FocusScope/index.tsx +++ b/src/components/FocusScope/index.tsx @@ -14,8 +14,7 @@ import { Text, View, } from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {useA11y} from '#/state/a11y' @@ -40,7 +39,7 @@ export function FocusScope({children}: {children: React.ReactNode}) { * remain within the active content section. */ function FocusTrap({children}: {children: React.ReactNode}) { - const {_} = useLingui() + const {t: l} = useLingui() const child = useRef(null) /* @@ -84,12 +83,8 @@ function FocusTrap({children}: {children: React.ReactNode}) { <> { switch (event.nativeEvent.actionName) { @@ -108,12 +103,8 @@ function FocusTrap({children}: {children: React.ReactNode}) { {decoratedChildren} { switch (event.nativeEvent.actionName) { diff --git a/src/components/InterestTabs.tsx b/src/components/InterestTabs.tsx index 5df1fb62e3..8cb8951cc8 100644 --- a/src/components/InterestTabs.tsx +++ b/src/components/InterestTabs.tsx @@ -5,8 +5,7 @@ import { View, type ViewStyle, } from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback' import {DraggableScrollView} from '#/view/com/pager/DraggableScrollView' @@ -46,7 +45,7 @@ export function InterestTabs({ gutterWidth?: number }) { const t = useTheme() - const {_} = useLingui() + const {t: l} = useLingui() const listRef = useRef(null) const [totalWidth, setTotalWidth] = useState(0) const [scrollX, setScrollX] = useState(0) @@ -255,7 +254,7 @@ export function InterestTabs({ }), ]}> - @@ -79,7 +75,7 @@ function DialogInner({ now: number }) { const control = Dialog.useDialogContext() - const {_} = useLingui() + const {t: l} = useLingui() const t = useTheme() const moderationOpts = useModerationOpts() const {currentAccount} = useSession() @@ -100,26 +96,22 @@ function DialogInner({ if (isMe) { if (profile.joinedViaStarterPack) { - return _( - msg`You joined Bluesky using a starter pack ${timeAgoString} ago`, - ) + return l`You joined Bluesky using a starter pack ${timeAgoString} ago` } else { - return _(msg`You joined Bluesky ${timeAgoString} ago`) + return l`You joined Bluesky ${timeAgoString} ago` } } else { if (profile.joinedViaStarterPack) { - return _( - msg`${profileName} joined Bluesky using a starter pack ${timeAgoString} ago`, - ) + return l`${profileName} joined Bluesky using a starter pack ${timeAgoString} ago` } else { - return _(msg`${profileName} joined Bluesky ${timeAgoString} ago`) + return l`${profileName} joined Bluesky ${timeAgoString} ago` } } } return ( @@ -166,7 +158,7 @@ function DialogInner({ {IS_NATIVE && ( ))} - - + - {isBlockedUser && ( {moderation.ui('profileView').alerts.map(cause => ( @@ -553,7 +545,6 @@ function Inner({ ))} )} - {!isBlockedUser && ( <> @@ -569,7 +560,7 @@ function Inner({ {following} diff --git a/src/components/ProgressGuide/Toast.tsx b/src/components/ProgressGuide/Toast.tsx index 961f3ed231..eb52204c2a 100644 --- a/src/components/ProgressGuide/Toast.tsx +++ b/src/components/ProgressGuide/Toast.tsx @@ -15,8 +15,7 @@ import Animated, { } from 'react-native-reanimated' import {useSafeAreaInsets} from 'react-native-safe-area-context' import {scheduleOnRN} from 'react-native-worklets' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {atoms as a, useTheme} from '#/alf' import {Portal} from '#/components/Portal' @@ -40,7 +39,7 @@ export const ProgressGuideToast = forwardRef< ProgressGuideToastProps >(function ProgressGuideToast({title, subtitle, visibleDuration}, ref) { const t = useTheme() - const {_} = useLingui() + const {t: l} = useLingui() const insets = useSafeAreaInsets() const [isOpen, setIsOpen] = useState(false) const translateY = useSharedValue(0) @@ -156,7 +155,7 @@ export const ProgressGuideToast = forwardRef< }, ]} onPress={close} - accessibilityLabel={_(msg`Tap to dismiss`)} + accessibilityLabel={l`Tap to dismiss`} accessibilityHint=""> }) { - const {_} = useLingui() + const {t: l} = useLingui() const {isLoading: isPreferencesLoading, data: preferences} = usePreferencesQuery() const { @@ -50,10 +49,10 @@ export function RichTextTag({ } = useRemoveMutedWordsMutation() const navigation = useNavigation() const isCashtag = tag.startsWith('$') - const label = isCashtag ? _(msg`Cashtag ${tag}`) : _(msg`Hashtag ${tag}`) + const label = isCashtag ? l`Cashtag ${tag}` : l`Hashtag ${tag}` const hint = IS_NATIVE - ? _(msg`Long press to open tag menu for ${isCashtag ? tag : `#${tag}`}`) - : _(msg`Click to open tag menu for ${isCashtag ? tag : `#${tag}`}`) + ? l`Long press to open tag menu for ${isCashtag ? tag : `#${tag}`}` + : l`Click to open tag menu for ${isCashtag ? tag : `#${tag}`}` const isMuted = Boolean( (preferences?.moderationPrefs.mutedWords?.find( @@ -111,7 +110,7 @@ export function RichTextTag({ { navigation.push('Hashtag', { tag: encodeURIComponent(tag), @@ -128,7 +127,7 @@ export function RichTextTag({ {authorHandle && !isInvalidHandle(authorHandle) && ( { navigation.push('Hashtag', { tag: encodeURIComponent(tag), @@ -150,8 +149,8 @@ export function RichTextTag({ { if (isMuted) { @@ -166,8 +165,8 @@ export function RichTextTag({ }}> {isMuted - ? _(msg`Unmute ${isCashtag ? tag : `#${tag}`}`) - : _(msg`Mute ${isCashtag ? tag : `#${tag}`}`)} + ? l`Unmute ${isCashtag ? tag : `#${tag}`}` + : l`Mute ${isCashtag ? tag : `#${tag}`}`} diff --git a/src/components/Select/index.tsx b/src/components/Select/index.tsx index a7dd70d8e7..27b5d2e06d 100644 --- a/src/components/Select/index.tsx +++ b/src/components/Select/index.tsx @@ -7,8 +7,7 @@ import { useState, } from 'react' import {View} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {atoms as a, useTheme} from '#/alf' import {Button, ButtonIcon, ButtonText} from '#/components/Button' @@ -170,7 +169,7 @@ function ContentInner({ valueExtractor, ...context }: ContentProps & ContextType) { - const {_} = useLingui() + const {t: l} = useLingui() const [headerHeight, setHeaderHeight] = useState(61) const render = useCallback( @@ -196,7 +195,7 @@ function ContentInner({ ]}> - {label ?? _(msg`Select an option`)} + {label ?? l`Select an option`} diff --git a/src/components/StarterPack/Main/PostsList.tsx b/src/components/StarterPack/Main/PostsList.tsx index ebd0dcf59d..1f6c471c5c 100644 --- a/src/components/StarterPack/Main/PostsList.tsx +++ b/src/components/StarterPack/Main/PostsList.tsx @@ -1,7 +1,6 @@ import {forwardRef, useCallback, useImperativeHandle} from 'react' import {View} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {type FeedDescriptor} from '#/state/queries/post-feed' import {PostFeed} from '#/view/com/posts/PostFeed' @@ -20,7 +19,7 @@ interface ProfilesListProps { export const PostsList = forwardRef( function PostsListImpl({listUri, headerHeight, scrollElRef}, ref) { const feed: FeedDescriptor = `list|${listUri}` - const {_} = useLingui() + const {t: l} = useLingui() const onScrollToTop = useCallback(() => { scrollElRef.current?.scrollToOffset({ @@ -38,10 +37,10 @@ export const PostsList = forwardRef( ) - }, [_]) + }, [l]) return ( diff --git a/src/components/StarterPack/ProfileStarterPacks.tsx b/src/components/StarterPack/ProfileStarterPacks.tsx index 69d4b5130e..9827495a0d 100644 --- a/src/components/StarterPack/ProfileStarterPacks.tsx +++ b/src/components/StarterPack/ProfileStarterPacks.tsx @@ -7,8 +7,7 @@ import { type ViewStyle, } from 'react-native' import {type AppBskyGraphDefs} from '@atproto/api' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {useNavigation} from '@react-navigation/native' @@ -90,7 +89,7 @@ export function ProfileStarterPacks({ const {isTabletOrDesktop} = useWebMediaQueries() const items = data?.pages.flatMap(page => page.starterPacks) - const {_} = useLingui() + const {t: l} = useLingui() const EmptyComponent = useCallback(() => { if (emptyStateMessage || emptyStateButton || emptyStateIcon) { @@ -101,9 +100,7 @@ export function ProfileStarterPacks({ iconSize="3xl" message={ emptyStateMessage ?? - _( - msg`Starter packs let you share your favorite feeds and people with your friends.`, - ) + l`Starter packs let you share your favorite feeds and people with your friends.` } button={emptyStateButton} /> @@ -111,7 +108,7 @@ export function ProfileStarterPacks({ ) } return - }, [_, emptyStateMessage, emptyStateButton, emptyStateIcon]) + }, [l, emptyStateMessage, emptyStateButton, emptyStateIcon]) useImperativeHandle(ref, () => ({ scrollToTop: () => {}, @@ -193,7 +190,7 @@ export function ProfileStarterPacks({ } function CreateAnother() { - const {_} = useLingui() + const {t: l} = useLingui() const t = useTheme() const navigation = useNavigation() @@ -207,7 +204,7 @@ function CreateAnother() { t.atoms.border_contrast_low, ]}> - @@ -349,12 +345,12 @@ function Empty() { { navigation.navigate('StarterPackWizard', {}) }} @@ -363,21 +359,17 @@ function Empty() { {}} showCancel={false} /> ) diff --git a/src/components/StarterPack/QrCodeDialog.tsx b/src/components/StarterPack/QrCodeDialog.tsx index e239eee9a4..f965877f0b 100644 --- a/src/components/StarterPack/QrCodeDialog.tsx +++ b/src/components/StarterPack/QrCodeDialog.tsx @@ -4,8 +4,7 @@ import type ViewShot from 'react-native-view-shot' import {requestPermissionsAsync, saveToLibraryAsync} from 'expo-media-library' import * as Sharing from 'expo-sharing' import {type AppBskyGraphDefs, AppBskyGraphStarterpack} from '@atproto/api' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {logger} from '#/logger' @@ -32,7 +31,7 @@ export function QrCodeDialog({ link?: string control: DialogControlProps }) { - const {_} = useLingui() + const {t: l} = useLingui() const ax = useAnalytics() const {gtMobile} = useBreakpoints() const [isSaveProcessing, setIsSaveProcessing] = useState(false) @@ -65,9 +64,7 @@ export function QrCodeDialog({ if (!res.granted) { Toast.show( - _( - msg`You must grant access to your photo library to save a QR code`, - ), + l`You must grant access to your photo library to save a QR code`, ) return } @@ -78,7 +75,7 @@ export function QrCodeDialog({ // works with the add-only permission on iOS (APP-2374) await saveToLibraryAsync(`file://${uri}`) } catch (e: unknown) { - Toast.show(_(msg`An error occurred while saving the QR code!`), { + Toast.show(l`An error occurred while saving the QR code!`, { type: 'error', }) logger.error('Failed to save QR code', {error: e}) @@ -118,8 +115,8 @@ export function QrCodeDialog({ setIsSaveProcessing(false) Toast.show( IS_WEB - ? _(msg`QR code has been downloaded!`) - : _(msg`QR code saved to your camera roll!`), + ? l`QR code has been downloaded!` + : l`QR code saved to your camera roll!`, ) control.close() }) @@ -140,7 +137,7 @@ export function QrCodeDialog({ shareType: 'qrcode', qrShareType: 'copy', }) - Toast.show(_(msg`QR code copied to your clipboard!`)) + Toast.show(l`QR code copied to your clipboard!`) setIsCopyProcessing(false) control.close() }) @@ -165,8 +162,7 @@ export function QrCodeDialog({ return ( - + }> {!link ? ( @@ -181,7 +177,7 @@ export function QrCodeDialog({ gtMobile && [a.flex_row, a.justify_center, a.flex_wrap], ]}> {IS_NATIVE && ( - {isThreadAuthor ? ( @@ -233,7 +229,7 @@ function WhoCanReplyDialog({ {IS_NATIVE && ( - ) diff --git a/src/components/ageAssurance/AgeAssuranceAdmonition.tsx b/src/components/ageAssurance/AgeAssuranceAdmonition.tsx index 46610b9dea..32d33d961e 100644 --- a/src/components/ageAssurance/AgeAssuranceAdmonition.tsx +++ b/src/components/ageAssurance/AgeAssuranceAdmonition.tsx @@ -1,6 +1,5 @@ import {View} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {atoms as a, select, useTheme, type ViewStyleProp} from '#/alf' @@ -40,7 +39,7 @@ function Inner({ control: Dialog.DialogControlProps }) { const t = useTheme() - const {_} = useLingui() + const {t: l} = useLingui() const ax = useAnalytics() return ( @@ -90,7 +89,7 @@ function Inner({ Learn more in your{' '} { diff --git a/src/components/ageAssurance/AgeAssuranceAppealDialog.tsx b/src/components/ageAssurance/AgeAssuranceAppealDialog.tsx index 1ee126eb28..5359b6457c 100644 --- a/src/components/ageAssurance/AgeAssuranceAppealDialog.tsx +++ b/src/components/ageAssurance/AgeAssuranceAppealDialog.tsx @@ -1,8 +1,7 @@ import {useState} from 'react' import {View} from 'react-native' import {ToolsOzoneReportDefs} from '@atproto/api' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {useMutation} from '@tanstack/react-query' @@ -23,12 +22,12 @@ export function AgeAssuranceAppealDialog({ }: { control: Dialog.DialogControlProps }) { - const {_} = useLingui() + const {t: l} = useLingui() return ( @@ -38,7 +37,7 @@ export function AgeAssuranceAppealDialog({ } function Inner({control}: {control: Dialog.DialogControlProps}) { - const {_} = useLingui() + const {t: l} = useLingui() const ax = useAnalytics() const {currentAccount} = useSession() const {gtPhone} = useBreakpoints() @@ -68,22 +67,17 @@ function Inner({control}: {control: Dialog.DialogControlProps}) { }, onError: err => { logger.error('AgeAssuranceAppealDialog failed', {safeMessage: err}) - Toast.show( - _(msg`Age assurance inquiry failed to send, please try again.`), - { - type: 'error', - }, - ) + Toast.show(l`Age assurance inquiry failed to send, please try again.`, { + type: 'error', + }) }, onSuccess: () => { control.close() Toast.show( - _( - msg({ - message: 'Age assurance inquiry was submitted', - context: 'toast', - }), - ), + l({ + message: 'Age assurance inquiry was submitted', + context: 'toast', + }), ) }, }) @@ -93,18 +87,15 @@ function Inner({control}: {control: Dialog.DialogControlProps}) { - Contact us - Please provide any additional details you feel moderators may need in order to properly assess your Age Assurance status. - { setDetails(details) }} - label={_(msg`Additional details (limit 1000 characters)`)} + label={l`Additional details (limit 1000 characters)`} numberOfLines={4} onSubmitEditing={() => mutate()} /> - - + Invite Friends @@ -70,7 +68,7 @@ export function InviteInfo({ )} - {showResendButton && ( @@ -229,8 +228,8 @@ export function DialogInner({ setSearch('')} /> @@ -246,13 +245,13 @@ export function DialogInner({ const flatListData = [ ...(isCheckedRecentEmpty - ? [{type: 'header', label: _(msg`Recently used`)}] + ? [{type: 'header', label: l`Recently used`}] : []), ...displayedLanguages.checkedRecent.map(lang => ({type: 'item', lang})), ...displayedLanguages.uncheckedRecent.map(lang => ({type: 'item', lang})), ...(isDisplayedLanguagesEmpty ? [] - : [{type: 'header', label: _(msg`All languages`)}]), + : [{type: 'header', label: l`All languages`}]), ...displayedLanguages.all.map(lang => ({type: 'item', lang})), ] @@ -264,7 +263,7 @@ export function DialogInner({ onChange={setCheckedLanguagesCode2} type="checkbox" maxSelections={maxLanguages} - label={_(msg`Select languages`)} + label={l`Select languages`} style={web([a.contents])}> setFooterHeight(evt.nativeEvent.layout.height)}> ), - [onPressCancel, _], + [onPressCancel, l], ) const saveButton = useCallback( () => ( diff --git a/src/components/moderation/LabelPreference.tsx b/src/components/moderation/LabelPreference.tsx index a654b46e24..42ffb0ea14 100644 --- a/src/components/moderation/LabelPreference.tsx +++ b/src/components/moderation/LabelPreference.tsx @@ -3,8 +3,7 @@ import { type InterpretedLabelValueDefinition, type LabelPreference, } from '@atproto/api' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {useGlobalLabelStrings} from '#/lib/moderation/useGlobalLabelStrings' @@ -78,15 +77,13 @@ export function Buttons({ hideLabel?: string disabled?: boolean }) { - const {_} = useLingui() + const {t: l} = useLingui() return ( {ignoreLabel && ( @@ -120,7 +117,7 @@ export function GlobalLabelPreference({ labelDefinition: InterpretedLabelValueDefinition disabled?: boolean }) { - const {_} = useLingui() + const {t: l} = useLingui() const {identifier} = labelDefinition const {data: preferences} = usePreferencesQuery() @@ -138,9 +135,9 @@ export function GlobalLabelPreference({ } const labelOptions = { - hide: _(msg`Hide`), - warn: _(msg`Warn`), - ignore: _(msg`Show`), + hide: l`Hide`, + warn: l`Warn`, + ignore: l`Show`, } return ( @@ -180,7 +177,7 @@ export function LabelerLabelPreference({ disabled?: boolean labelerDid?: string }) { - const {_, i18n} = useLingui() + const {t: l, i18n} = useLingui() const t = useTheme() const {gtPhone} = useBreakpoints() @@ -254,7 +251,7 @@ export function LabelerLabelPreference({ Configured in{' '} moderation settings @@ -266,7 +263,6 @@ export function LabelerLabelPreference({ )} - {showConfig && ( <> {cantConfigure ? ( diff --git a/src/components/moderation/LabelsOnMe.tsx b/src/components/moderation/LabelsOnMe.tsx index 85cb1e4a3a..dc4557469d 100644 --- a/src/components/moderation/LabelsOnMe.tsx +++ b/src/components/moderation/LabelsOnMe.tsx @@ -1,7 +1,6 @@ import {type StyleProp, View, type ViewStyle} from 'react-native' import {type ComAtprotoLabelDefs} from '@atproto/api' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Plural} from '@lingui/react/macro' import {filterUserFacingLabels} from '#/lib/moderation' @@ -28,7 +27,7 @@ export function LabelsOnMe({ size?: ButtonSize style?: StyleProp }) { - const {_} = useLingui() + const {t: l} = useLingui() const {currentAccount} = useSession() const control = useLabelsOnMeDialogControl() @@ -43,12 +42,11 @@ export function LabelsOnMe({ return ( - @@ -98,7 +94,6 @@ export function VerificationCreatePrompt({ )} - ) diff --git a/src/components/verification/VerificationRemovePrompt.tsx b/src/components/verification/VerificationRemovePrompt.tsx index 96b119ceb1..4a3fa94d0c 100644 --- a/src/components/verification/VerificationRemovePrompt.tsx +++ b/src/components/verification/VerificationRemovePrompt.tsx @@ -1,7 +1,6 @@ import {useCallback} from 'react' import {type AppBskyActorDefs} from '@atproto/api' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {logger} from '#/logger' import {useVerificationsRemoveMutation} from '#/state/queries/verification/useVerificationsRemoveMutation' @@ -23,29 +22,29 @@ export function VerificationRemovePrompt({ verifications: AppBskyActorDefs.VerificationView[] onConfirm?: () => void }) { - const {_} = useLingui() + const {t: l} = useLingui() const {mutateAsync: remove} = useVerificationsRemoveMutation() const onConfirm = useCallback(async () => { onConfirmInner?.() try { await remove({profile, verifications}) - Toast.show(_(msg`Removed verification`)) + Toast.show(l`Removed verification`) } catch (e) { - Toast.show(_(msg`Failed to remove verification`), { + Toast.show(l`Failed to remove verification`, { type: 'error', }) logger.error('Failed to remove verification', { safeMessage: e, }) } - }, [_, profile, verifications, remove, onConfirmInner]) + }, [l, profile, verifications, remove, onConfirmInner]) return ( ) diff --git a/src/components/verification/VerificationsDialog.tsx b/src/components/verification/VerificationsDialog.tsx index cb24b182a5..be33dbfc0e 100644 --- a/src/components/verification/VerificationsDialog.tsx +++ b/src/components/verification/VerificationsDialog.tsx @@ -1,7 +1,6 @@ import {View} from 'react-native' import {type AppBskyActorDefs} from '@atproto/api' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {urls} from '#/lib/constants' @@ -57,22 +56,20 @@ function Inner({ }) { const t = useTheme() const ax = useAnalytics() - const {_} = useLingui() + const {t: l} = useLingui() const {gtMobile} = useBreakpoints() const userName = getUserDisplayName(profile) const label = state.profile.isViewer ? state.profile.isVerified - ? _(msg`You are verified`) - : _(msg`Your verifications`) + ? l`You are verified` + : l`Your verifications` : state.profile.isVerified - ? _(msg`${userName} is verified`) - : _( - msg({ - message: `${userName}'s verifications`, - comment: `Possessive, meaning "the verifications of {userName}"`, - }), - ) + ? l`${userName} is verified` + : l({ + message: `${userName}'s verifications`, + comment: `Possessive, meaning "the verifications of {userName}"`, + }) return ( - {profile.verification ? ( @@ -124,7 +120,6 @@ function Inner({ )} ) : null} - diff --git a/src/features/liveNow/index.tsx b/src/features/liveNow/index.tsx index fb1f04b728..87ea3e313d 100644 --- a/src/features/liveNow/index.tsx +++ b/src/features/liveNow/index.tsx @@ -9,8 +9,7 @@ import { moderateStatus, } from '@atproto/api' import {retry} from '@atproto/common-web' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query' import {isAfter, parseISO} from 'date-fns' @@ -185,7 +184,7 @@ export function isStatusValidForViewers( export function useLiveLinkMetaQuery(url: string | null) { const liveNowConfig = useLiveNowConfig() - const {_} = useLingui() + const {t: l} = useLingui() const agent = useAgent() return useQuery({ @@ -199,9 +198,7 @@ export function useLiveLinkMetaQuery(url: string | null) { liveNowConfig.currentAccountAllowedHosts, ) throw new Error( - _( - msg`This service is not supported while the Live feature is in beta. Allowed services: ${formatted}.`, - ), + l`This service is not supported while the Live feature is in beta. Allowed services: ${formatted}.`, ) } @@ -220,7 +217,7 @@ export function useUpsertLiveStatusMutation( const agent = useAgent() const queryClient = useQueryClient() const control = useDialogContext() - const {_} = useLingui() + const {t: l} = useLingui() return useMutation({ mutationFn: async () => { @@ -312,7 +309,7 @@ export function useUpsertLiveStatusMutation( ax.metric('live:create', {duration: record.durationMinutes}) } - Toast.show(_(msg`You are now live!`)) + Toast.show(l`You are now live!`) control.close(() => { if (!currentAccount) return @@ -350,7 +347,7 @@ export function useRemoveLiveStatusMutation() { const agent = useAgent() const queryClient = useQueryClient() const control = useDialogContext() - const {_} = useLingui() + const {t: l} = useLingui() return useMutation({ mutationFn: async () => { @@ -368,7 +365,7 @@ export function useRemoveLiveStatusMutation() { }, onSuccess: () => { ax.metric('live:remove', {}) - Toast.show(_(msg`You are no longer live`)) + Toast.show(l`You are no longer live`) control.close(() => { if (!currentAccount) return diff --git a/src/lib/generate-starterpack.ts b/src/lib/generate-starterpack.ts index a53e95a6a3..4fc14650c2 100644 --- a/src/lib/generate-starterpack.ts +++ b/src/lib/generate-starterpack.ts @@ -6,8 +6,7 @@ import { type ComAtprotoRepoApplyWrites, type Facet, } from '@atproto/api' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {useMutation} from '@tanstack/react-query' import {until} from '#/lib/async/until' @@ -59,7 +58,7 @@ export function useGenerateStarterPackMutation({ onSuccess: ({uri, cid}: {uri: string; cid: string}) => void onError: (e: Error) => void }) { - const {_} = useLingui() + const {t: l} = useLingui() const agent = useAgent() return useMutation<{uri: string; cid: string}, Error, void>({ @@ -101,7 +100,7 @@ export function useGenerateStarterPackMutation({ 25, true, ) - const starterPackName = _(msg`${displayName}'s Starter Pack`) + const starterPackName = l`${displayName}'s Starter Pack` const list = await createStarterPackList({ name: starterPackName, diff --git a/src/lib/hooks/useAccountSwitcher.ts b/src/lib/hooks/useAccountSwitcher.ts index 106e92d37a..bb1ffcfa33 100644 --- a/src/lib/hooks/useAccountSwitcher.ts +++ b/src/lib/hooks/useAccountSwitcher.ts @@ -1,6 +1,5 @@ import {useCallback, useState} from 'react' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {logger} from '#/logger' import {type SessionAccount, useSessionApi} from '#/state/session' @@ -13,7 +12,7 @@ import {IS_WEB} from '#/env' export function useAccountSwitcher() { const ax = useAnalytics() const [pendingDid, setPendingDid] = useState(null) - const {_} = useLingui() + const {t: l} = useLingui() const {resumeSession} = useSessionApi() const {requestSwitchToAccount} = useLoggedOutViewControls() @@ -39,10 +38,10 @@ export function useAccountSwitcher() { } await resumeSession(account, true) ax.metric('account:loggedIn', {logContext, withPassword: false}) - Toast.show(_(msg`Signed in as @${account.handle}`)) + Toast.show(l`Signed in as @${account.handle}`) } else { requestSwitchToAccount({requestedAccount: account.did}) - Toast.show(_(msg`Please sign in as @${account.handle}`), { + Toast.show(l`Please sign in as @${account.handle}`, { type: 'warning', }) } @@ -51,14 +50,14 @@ export function useAccountSwitcher() { message: e.message, }) requestSwitchToAccount({requestedAccount: account.did}) - Toast.show(_(msg`Please sign in as @${account.handle}`), { + Toast.show(l`Please sign in as @${account.handle}`, { type: 'warning', }) } finally { setPendingDid(null) } }, - [_, ax, resumeSession, requestSwitchToAccount, pendingDid], + [l, ax, resumeSession, requestSwitchToAccount, pendingDid], ) return {onPressSwitchAccount, pendingDid} diff --git a/src/lib/hooks/useCreateSupportLink.ts b/src/lib/hooks/useCreateSupportLink.ts index 5f5bfd5720..757b229569 100644 --- a/src/lib/hooks/useCreateSupportLink.ts +++ b/src/lib/hooks/useCreateSupportLink.ts @@ -1,6 +1,5 @@ import {useCallback} from 'react' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {useSession} from '#/state/session' @@ -16,7 +15,7 @@ export enum SupportCode { * {@link https://support.zendesk.com/hc/en-us/articles/4408839114522-Creating-pre-filled-ticket-forms} */ export function useCreateSupportLink() { - const {_} = useLingui() + const {t: l} = useLingui() const {currentAccount} = useSession() return useCallback( @@ -26,7 +25,7 @@ export function useCreateSupportLink() { url.search = new URLSearchParams({ tf_anonymous_requester_email: email || currentAccount.email || '', // email will be defined tf_description: - `[Code: ${code}] — ` + _(msg`Please write your message below:`), + `[Code: ${code}] — ` + l`Please write your message below:`, /** * Custom field specific to {@link ZENDESK_SUPPORT_URL} form */ @@ -35,6 +34,6 @@ export function useCreateSupportLink() { } return url.toString() }, - [_, currentAccount], + [l, currentAccount], ) } diff --git a/src/lib/interests.ts b/src/lib/interests.ts index 45f9183d1e..4a2b41321d 100644 --- a/src/lib/interests.ts +++ b/src/lib/interests.ts @@ -1,6 +1,5 @@ import {useMemo} from 'react' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' export const interests = [ 'animals', @@ -44,35 +43,35 @@ export const popularInterests = [ ] satisfies Interest[] export function useInterestsDisplayNames() { - const {_} = useLingui() + const {t: l} = useLingui() return useMemo>(() => { return { // Keep this alphabetized - animals: _(msg`Animals`), - art: _(msg`Art`), - books: _(msg`Books`), - comedy: _(msg`Comedy`), - comics: _(msg`Comics`), - culture: _(msg`Culture`), - dev: _(msg`Software Dev`), - education: _(msg`Education`), - finance: _(msg`Finance`), - food: _(msg`Food`), - gaming: _(msg`Video Games`), - journalism: _(msg`Journalism`), - movies: _(msg`Movies`), - music: _(msg`Music`), - nature: _(msg`Nature`), - news: _(msg`News`), - pets: _(msg`Pets`), - photography: _(msg`Photography`), - politics: _(msg`Politics`), - science: _(msg`Science`), - sports: _(msg`Sports`), - tech: _(msg`Tech`), - tv: _(msg`TV`), - writers: _(msg`Writers`), + animals: l`Animals`, + art: l`Art`, + books: l`Books`, + comedy: l`Comedy`, + comics: l`Comics`, + culture: l`Culture`, + dev: l`Software Dev`, + education: l`Education`, + finance: l`Finance`, + food: l`Food`, + gaming: l`Video Games`, + journalism: l`Journalism`, + movies: l`Movies`, + music: l`Music`, + nature: l`Nature`, + news: l`News`, + pets: l`Pets`, + photography: l`Photography`, + politics: l`Politics`, + science: l`Science`, + sports: l`Sports`, + tech: l`Tech`, + tv: l`TV`, + writers: l`Writers`, } satisfies Record - }, [_]) + }, [l]) } diff --git a/src/lib/media/save-image.ios.ts b/src/lib/media/save-image.ios.ts index 7bd270de8a..135f6685f8 100644 --- a/src/lib/media/save-image.ios.ts +++ b/src/lib/media/save-image.ios.ts @@ -1,6 +1,5 @@ import {useCallback} from 'react' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import * as Toast from '#/components/Toast' import {IS_NATIVE} from '#/env' @@ -13,7 +12,7 @@ import {saveImageToMediaLibrary} from './manip' * so this file is platform-split as it's much simpler than the Android version. */ export function useSaveImageToMediaLibrary() { - const {_} = useLingui() + const {t: l} = useLingui() return useCallback( async (uri: string) => { if (!IS_NATIVE) { @@ -22,11 +21,11 @@ export function useSaveImageToMediaLibrary() { try { await saveImageToMediaLibrary({uri}) - Toast.show(_(msg`Image saved`)) + Toast.show(l`Image saved`) } catch (e: any) { - Toast.show(_(msg`Failed to save image: ${String(e)}`), {type: 'error'}) + Toast.show(l`Failed to save image: ${String(e)}`, {type: 'error'}) } }, - [_], + [l], ) } diff --git a/src/lib/media/save-image.ts b/src/lib/media/save-image.ts index bf48d8e685..a08d36100c 100644 --- a/src/lib/media/save-image.ts +++ b/src/lib/media/save-image.ts @@ -1,7 +1,6 @@ import {useCallback} from 'react' import * as MediaLibrary from 'expo-media-library' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import * as Toast from '#/components/Toast' import {IS_NATIVE} from '#/env' @@ -11,7 +10,7 @@ import {saveImageToMediaLibrary} from './manip' * Same as `saveImageToMediaLibrary`, but also handles permissions and toasts */ export function useSaveImageToMediaLibrary() { - const {_} = useLingui() + const {t: l} = useLingui() const [permissionResponse, requestPermission, getPermission] = MediaLibrary.usePermissions({ granularPermissions: ['photo'], @@ -26,9 +25,9 @@ export function useSaveImageToMediaLibrary() { try { await saveImageToMediaLibrary({uri}) - Toast.show(_(msg`Image saved`)) + Toast.show(l`Image saved`) } catch (e: any) { - Toast.show(_(msg`Failed to save image: ${String(e)}`), { + Toast.show(l`Failed to save image: ${String(e)}`, { type: 'error', }) } @@ -47,22 +46,18 @@ export function useSaveImageToMediaLibrary() { } else { // since we've been explicitly denied, show a toast. Toast.show( - _( - msg`Images cannot be saved unless permission is granted to access your photo library.`, - ), + l`Images cannot be saved unless permission is granted to access your photo library.`, {type: 'error'}, ) } } else { Toast.show( - _( - msg`Permission to access your photo library was denied. Please enable it in your system settings.`, - ), + l`Permission to access your photo library was denied. Please enable it in your system settings.`, {type: 'error'}, ) } } }, - [permissionResponse, requestPermission, getPermission, _], + [permissionResponse, requestPermission, getPermission, l], ) } diff --git a/src/lib/moderation/useGlobalLabelStrings.ts b/src/lib/moderation/useGlobalLabelStrings.ts index f308e04d1d..9896668546 100644 --- a/src/lib/moderation/useGlobalLabelStrings.ts +++ b/src/lib/moderation/useGlobalLabelStrings.ts @@ -1,6 +1,5 @@ import {useMemo} from 'react' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' export type GlobalLabelStrings = Record< string, @@ -11,46 +10,42 @@ export type GlobalLabelStrings = Record< > export function useGlobalLabelStrings(): GlobalLabelStrings { - const {_} = useLingui() + const {t: l} = useLingui() return useMemo( () => ({ '!hide': { - name: _(msg`Content Blocked`), - description: _(msg`This content has been hidden by the moderators.`), + name: l`Content Blocked`, + description: l`This content has been hidden by the moderators.`, }, '!warn': { - name: _(msg`Content Warning`), - description: _( - msg`This content has received a general warning from moderators.`, - ), + name: l`Content Warning`, + description: l`This content has received a general warning from moderators.`, }, '!no-unauthenticated': { - name: _(msg`Sign-in Required`), - description: _( - msg`This user has requested that their content only be shown to signed-in users.`, - ), + name: l`Sign-in Required`, + description: l`This user has requested that their content only be shown to signed-in users.`, }, porn: { - name: _(msg`Adult Content`), - description: _(msg`Explicit sexual images.`), + name: l`Adult Content`, + description: l`Explicit sexual images.`, }, sexual: { - name: _(msg`Sexually Suggestive`), - description: _(msg`Does not include nudity.`), + name: l`Sexually Suggestive`, + description: l`Does not include nudity.`, }, nudity: { - name: _(msg`Non-sexual Nudity`), - description: _(msg`E.g. artistic nudes.`), + name: l`Non-sexual Nudity`, + description: l`E.g. artistic nudes.`, }, 'graphic-media': { - name: _(msg`Graphic Media`), - description: _(msg`Explicit or potentially disturbing media.`), + name: l`Graphic Media`, + description: l`Explicit or potentially disturbing media.`, }, gore: { - name: _(msg`Graphic Media`), - description: _(msg`Explicit or potentially disturbing media.`), + name: l`Graphic Media`, + description: l`Explicit or potentially disturbing media.`, }, }), - [_], + [l], ) } diff --git a/src/lib/moderation/useLabelBehaviorDescription.ts b/src/lib/moderation/useLabelBehaviorDescription.ts index cdded25924..e7ff1784de 100644 --- a/src/lib/moderation/useLabelBehaviorDescription.ts +++ b/src/lib/moderation/useLabelBehaviorDescription.ts @@ -2,37 +2,36 @@ import { type InterpretedLabelValueDefinition, type LabelPreference, } from '@atproto/api' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' export function useLabelBehaviorDescription( labelValueDef: InterpretedLabelValueDefinition, pref: LabelPreference, ) { - const {_} = useLingui() + const {t: l} = useLingui() if (pref === 'ignore') { - return _(msg`Off`) + return l`Off` } if (labelValueDef.blurs === 'content' || labelValueDef.blurs === 'media') { if (pref === 'hide') { - return _(msg`Hide`) + return l`Hide` } - return _(msg`Warn`) + return l`Warn` } else if (labelValueDef.severity === 'alert') { if (pref === 'hide') { - return _(msg`Hide`) + return l`Hide` } - return _(msg`Warn`) + return l`Warn` } else if (labelValueDef.severity === 'inform') { if (pref === 'hide') { - return _(msg`Hide`) + return l`Hide` } - return _(msg`Show badge`) + return l`Show badge` } else { if (pref === 'hide') { - return _(msg`Hide`) + return l`Hide` } - return _(msg`Disabled`) + return l`Disabled` } } @@ -40,34 +39,34 @@ export function useLabelLongBehaviorDescription( labelValueDef: InterpretedLabelValueDefinition, pref: LabelPreference, ) { - const {_} = useLingui() + const {t: l} = useLingui() if (pref === 'ignore') { - return _(msg`Disabled`) + return l`Disabled` } if (labelValueDef.blurs === 'content') { if (pref === 'hide') { - return _(msg`Warn content and filter from feeds`) + return l`Warn content and filter from feeds` } - return _(msg`Warn content`) + return l`Warn content` } else if (labelValueDef.blurs === 'media') { if (pref === 'hide') { - return _(msg`Blur images and filter from feeds`) + return l`Blur images and filter from feeds` } - return _(msg`Blur images`) + return l`Blur images` } else if (labelValueDef.severity === 'alert') { if (pref === 'hide') { - return _(msg`Show warning and filter from feeds`) + return l`Show warning and filter from feeds` } - return _(msg`Show warning`) + return l`Show warning` } else if (labelValueDef.severity === 'inform') { if (pref === 'hide') { - return _(msg`Show badge and filter from feeds`) + return l`Show badge and filter from feeds` } - return _(msg`Show badge`) + return l`Show badge` } else { if (pref === 'hide') { - return _(msg`Filter from feeds`) + return l`Filter from feeds` } - return _(msg`Disabled`) + return l`Disabled` } } diff --git a/src/lib/moderation/useLabelInfo.ts b/src/lib/moderation/useLabelInfo.ts index f398406078..5708b68ec0 100644 --- a/src/lib/moderation/useLabelInfo.ts +++ b/src/lib/moderation/useLabelInfo.ts @@ -5,7 +5,7 @@ import { interpretLabelValueDefinition, LABELS, } from '@atproto/api' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import * as bcp47Match from 'bcp-47-match' import { diff --git a/src/lib/moderation/useModerationCauseDescription.ts b/src/lib/moderation/useModerationCauseDescription.ts index d11d16dca3..eea5bf6343 100644 --- a/src/lib/moderation/useModerationCauseDescription.ts +++ b/src/lib/moderation/useModerationCauseDescription.ts @@ -4,8 +4,7 @@ import { type ModerationCause, type ModerationCauseSource, } from '@atproto/api' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {sanitizeHandle} from '#/lib/strings/handles' import {useLabelDefinitions} from '#/state/preferences' @@ -35,7 +34,7 @@ export function useModerationCauseDescription( cause: ModerationCause | AppModerationCause | undefined, ): ModerationCauseDescription { const {currentAccount} = useSession() - const {_, i18n} = useLingui() + const {t: l, i18n} = useLingui() const {labelDefs, labelers} = useLabelDefinitions() const globalLabelStrings = useGlobalLabelStrings() @@ -43,90 +42,76 @@ export function useModerationCauseDescription( if (!cause) { return { icon: Warning, - name: _(msg`Content Warning`), - description: _( - msg`Moderator has chosen to set a general warning on the content.`, - ), + name: l`Content Warning`, + description: l`Moderator has chosen to set a general warning on the content.`, } } if (cause.type === 'blocking') { if (cause.source.type === 'list') { return { icon: CircleBanSign, - name: _(msg`User Blocked by "${cause.source.list.name}"`), - description: _( - msg`You have blocked this user. You cannot view their content.`, - ), + name: l`User Blocked by "${cause.source.list.name}"`, + description: l`You have blocked this user. You cannot view their content.`, } } else { return { icon: CircleBanSign, - name: _(msg`User Blocked`), - description: _( - msg`You have blocked this user. You cannot view their content.`, - ), + name: l`User Blocked`, + description: l`You have blocked this user. You cannot view their content.`, } } } if (cause.type === 'blocked-by') { return { icon: CircleBanSign, - name: _(msg`User Blocking You`), - description: _( - msg`This user has blocked you. You cannot view their content.`, - ), + name: l`User Blocking You`, + description: l`This user has blocked you. You cannot view their content.`, } } if (cause.type === 'block-other') { return { icon: CircleBanSign, - name: _(msg`Content Not Available`), - description: _( - msg`This content is not available because one of the users involved has blocked the other.`, - ), + name: l`Content Not Available`, + description: l`This content is not available because one of the users involved has blocked the other.`, } } if (cause.type === 'muted') { if (cause.source.type === 'list') { return { icon: EyeSlash, - name: _(msg`Muted by "${cause.source.list.name}"`), - description: _(msg`You have muted this user`), + name: l`Muted by "${cause.source.list.name}"`, + description: l`You have muted this user`, } } else { return { icon: EyeSlash, - name: _(msg`Account Muted`), - description: _(msg`You have muted this account.`), + name: l`Account Muted`, + description: l`You have muted this account.`, } } } if (cause.type === 'mute-word') { return { icon: EyeSlash, - name: _(msg`Post Hidden by Muted Word`), - description: _( - msg`You've chosen to hide a word or tag within this post.`, - ), + name: l`Post Hidden by Muted Word`, + description: l`You've chosen to hide a word or tag within this post.`, } } if (cause.type === 'hidden') { return { icon: EyeSlash, - name: _(msg`Post Hidden by You`), - description: _(msg`You have hidden this post`), + name: l`Post Hidden by You`, + description: l`You have hidden this post`, } } if (cause.type === 'reply-hidden') { const isMe = currentAccount?.did === cause.source.did return { icon: EyeSlash, - name: isMe - ? _(msg`Reply Hidden by You`) - : _(msg`Reply Hidden by Thread Author`), + name: isMe ? l`Reply Hidden by You` : l`Reply Hidden by Thread Author`, description: isMe - ? _(msg`You hid this reply.`) - : _(msg`The author of this thread has hidden this reply.`), + ? l`You hid this reply.` + : l`The author of this thread has hidden this reply.`, } } if (cause.type === 'label') { @@ -142,11 +127,11 @@ export function useModerationCauseDescription( source = 'moderation.bsky.app' sourceDisplayName = 'Bluesky Moderation Service' } else { - source = _(msg`an unknown labeler`) + source = l`an unknown labeler` } } if (def.identifier === 'porn' || def.identifier === 'sexual') { - strings.name = _(msg`Adult Content`) + strings.name = l`Adult Content` } return { @@ -177,7 +162,7 @@ export function useModerationCauseDescription( labelers, globalLabelStrings, cause, - _, + l, i18n.locale, currentAccount?.did, ]) diff --git a/src/screens/Bookmarks.tsx b/src/screens/Bookmarks.tsx index fdeb91777c..4bca1979ba 100644 --- a/src/screens/Bookmarks.tsx +++ b/src/screens/Bookmarks.tsx @@ -5,8 +5,7 @@ import { type AppBskyBookmarkDefs, AppBskyFeedDefs, } from '@atproto/api' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import { type NavigationProp, @@ -202,13 +201,13 @@ function BookmarkNotFound({ post: $Typed }) { const t = useTheme() - const {_} = useLingui() + const {t: l} = useLingui() const {mutateAsync: bookmark} = useBookmarkMutation() const remove = async () => { try { await bookmark({action: 'delete', uri: post.uri}) - toast.show(_(msg`Removed from saved posts`), { + toast.show(l`Removed from saved posts`, { type: 'info', }) } catch (err) { @@ -249,7 +248,7 @@ function BookmarkNotFound({ ) diff --git a/src/screens/FindContactsFlowScreen.tsx b/src/screens/FindContactsFlowScreen.tsx index 0a7ebc2f6c..eacc47ace5 100644 --- a/src/screens/FindContactsFlowScreen.tsx +++ b/src/screens/FindContactsFlowScreen.tsx @@ -1,7 +1,6 @@ import {useState} from 'react' import {LayoutAnimationConfig} from 'react-native-reanimated' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {usePreventRemove} from '@react-navigation/native' import { @@ -18,7 +17,7 @@ import {IS_NATIVE} from '#/env' type Props = NativeStackScreenProps export function FindContactsFlowScreen({navigation}: Props) { - const {_} = useLingui() + const {t: l} = useLingui() const [state, dispatch] = useFindContactsFlowState() @@ -59,8 +58,8 @@ export function FindContactsFlowScreen({navigation}: Props) { ) : ( )} diff --git a/src/screens/Home/NoFeedsPinned.tsx b/src/screens/Home/NoFeedsPinned.tsx index 54957c3fe1..ff06b3669b 100644 --- a/src/screens/Home/NoFeedsPinned.tsx +++ b/src/screens/Home/NoFeedsPinned.tsx @@ -1,8 +1,7 @@ import {useCallback} from 'react' import {View} from 'react-native' import {TID} from '@atproto/common-web' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {DISCOVER_SAVED_FEED, TIMELINE_SAVED_FEED} from '#/lib/constants' @@ -22,7 +21,7 @@ export function NoFeedsPinned({ }: { preferences: UsePreferencesQueryResponse }) { - const {_} = useLingui() + const {t: l} = useLingui() const headerOffset = useHeaderOffset() const {isPending, mutateAsync: overwriteSavedFeeds} = useOverwriteSavedFeedsMutation() @@ -91,23 +90,23 @@ export function NoFeedsPinned({ - {_(msg`Browse other feeds`)} + {l`Browse other feeds`} diff --git a/src/screens/List/ListHiddenScreen.tsx b/src/screens/List/ListHiddenScreen.tsx index aea2465d7f..a6f5fd2602 100644 --- a/src/screens/List/ListHiddenScreen.tsx +++ b/src/screens/List/ListHiddenScreen.tsx @@ -1,8 +1,7 @@ import {useState} from 'react' import {View} from 'react-native' import {AppBskyGraphDefs} from '@atproto/api' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {useQueryClient} from '@tanstack/react-query' @@ -35,7 +34,7 @@ export function ListHiddenScreen({ list: AppBskyGraphDefs.ListView preferences: UsePreferencesQueryResponse }) { - const {_} = useLingui() + const {t: l} = useLingui() const t = useTheme() const {currentAccount} = useSession() const {gtMobile} = useBreakpoints() @@ -63,9 +62,7 @@ export function ListHiddenScreen({ setIsProcessing(false) logger.error('Failed to unmute list', {message: e}) Toast.show( - _( - msg`There was an issue. Please check your internet connection and try again.`, - ), + l`There was an issue. Please check your internet connection and try again.`, ) return } @@ -77,9 +74,7 @@ export function ListHiddenScreen({ setIsProcessing(false) logger.error('Failed to unblock list', {message: e}) Toast.show( - _( - msg`There was an issue. Please check your internet connection and try again.`, - ), + l`There was an issue. Please check your internet connection and try again.`, ) return } @@ -87,7 +82,7 @@ export function ListHiddenScreen({ queryClient.invalidateQueries({ queryKey: [listQueryRoot], }) - Toast.show(_(msg`Unsubscribed from list`)) + Toast.show(l`Unsubscribed from list`) setIsProcessing(false) } @@ -95,13 +90,11 @@ export function ListHiddenScreen({ if (!savedFeedConfig) return try { await removeSavedFeed(savedFeedConfig) - Toast.show(_(msg`Removed from saved feeds`)) + Toast.show(l`Removed from saved feeds`) } catch (e) { logger.error('Failed to remove list from saved feeds', {message: e}) Toast.show( - _( - msg`There was an issue. Please check your internet connection and try again.`, - ), + l`There was an issue. Please check your internet connection and try again.`, ) } finally { setIsProcessing(false) @@ -171,7 +164,7 @@ export function ListHiddenScreen({ variant="solid" color="secondary" size="large" - label={_(msg`Remove from saved feeds`)} + label={l`Remove from saved feeds`} onPress={onRemoveList} disabled={isProcessing}> @@ -187,7 +180,7 @@ export function ListHiddenScreen({ variant="solid" color="secondary" size="large" - label={_(msg`Show list anyway`)} + label={l`Show list anyway`} onPress={() => setIsContentVisible(true)} disabled={isProcessing}> @@ -199,7 +192,7 @@ export function ListHiddenScreen({ variant="solid" color="secondary" size="large" - label={_(msg`Unsubscribe from list`)} + label={l`Unsubscribe from list`} onPress={() => { if (isModList) { onUnsubscribe() @@ -220,7 +213,7 @@ export function ListHiddenScreen({ @@ -141,7 +140,6 @@ export function Layout({children}: React.PropsWithChildren<{}>) { )} )} - ) { - setFooterHeight(evt.nativeEvent.layout.height)} style={[ @@ -195,7 +192,7 @@ export function Layout({children}: React.PropsWithChildren<{}>) { variant="ghost" shape="square" size="small" - label={_(msg`Go back to previous step`)} + label={l`Go back to previous step`} onPress={() => dispatch({type: 'prev'})}> diff --git a/src/screens/Onboarding/StepFindContactsIntro/index.tsx b/src/screens/Onboarding/StepFindContactsIntro/index.tsx index bc6f309b7b..b66f244dc9 100644 --- a/src/screens/Onboarding/StepFindContactsIntro/index.tsx +++ b/src/screens/Onboarding/StepFindContactsIntro/index.tsx @@ -1,7 +1,6 @@ import {View} from 'react-native' import * as Contacts from 'expo-contacts' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {useQuery} from '@tanstack/react-query' @@ -23,7 +22,7 @@ import {useOnboardingInternalState} from '../state' export function StepFindContactsIntro() { const ax = useAnalytics() - const {_} = useLingui() + const {t: l} = useLingui() const {dispatch} = useOnboardingInternalState() useCallOnce(() => { @@ -49,12 +48,10 @@ export function StepFindContactsIntro() { control what happens next.{' '} Learn more @@ -68,12 +65,11 @@ export function StepFindContactsIntro() { )} - )} - setSubStep(ss)} avatarUri={state.profileStepResults.imageUri} /> - {gtMobile && (IS_WEB ? subStep !== 2 : true) && ( @@ -311,7 +308,7 @@ function ValueProposition({ disabled={saving} color="secondary" size="large" - label={_(msg`Skip introduction and start using your account`)} + label={l`Skip introduction and start using your account`} onPress={() => finishOnboarding()}> Skip @@ -326,8 +323,8 @@ function ValueProposition({ size="large" label={ subStep === 2 - ? _(msg`Complete onboarding and start using your account`) - : _(msg`Next`) + ? l`Complete onboarding and start using your account` + : l`Next` } onPress={onPress}> diff --git a/src/screens/Onboarding/StepInterests/index.tsx b/src/screens/Onboarding/StepInterests/index.tsx index 2b9afa0630..8681cc30a6 100644 --- a/src/screens/Onboarding/StepInterests/index.tsx +++ b/src/screens/Onboarding/StepInterests/index.tsx @@ -1,7 +1,6 @@ import {useCallback, useState} from 'react' import {View} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {interests, useInterestsDisplayNames} from '#/lib/interests' @@ -22,7 +21,7 @@ import {Loader} from '#/components/Loader' import {useAnalytics} from '#/analytics' export function StepInterests() { - const {_} = useLingui() + const {t: l} = useLingui() const ax = useAnalytics() const interestsDisplayNames = useInterestsDisplayNames() @@ -61,12 +60,11 @@ export function StepInterests() { We'll use this to help customize your experience. - + label={l`Select your interests from the options below`}> {interests.map(interest => ( - ), - [onPressCancel, _], + [onPressCancel, l], ) const saveButton = useCallback( () => ( )} @@ -362,7 +352,7 @@ export function HeaderStandardButtons({ testID="unblockBtn" size="small" color="secondary" - label={_(msg`Unblock`)} + label={l`Unblock`} disabled={!hasSession} onPress={() => unblockPromptControl.open()}> @@ -393,8 +383,8 @@ export function HeaderStandardButtons({ color={profile.viewer?.following ? 'secondary' : 'primary'} label={ profile.viewer?.following - ? _(msg`Unfollow ${profile.handle}`) - : _(msg`Follow ${profile.handle}`) + ? l`Unfollow ${profile.handle}` + : l`Follow ${profile.handle}` } onPress={ profile.viewer?.following ? onPressUnfollow : onPressFollow @@ -414,17 +404,14 @@ export function HeaderStandardButtons({ ) : null} - { void unblockAccount() }} - confirmButtonCta={_(msg`Unblock`)} + confirmButtonCta={l`Unblock`} confirmButtonColor="negative" /> diff --git a/src/screens/Profile/KnownFollowers.tsx b/src/screens/Profile/KnownFollowers.tsx index 09c1034b07..679a1e4e2d 100644 --- a/src/screens/Profile/KnownFollowers.tsx +++ b/src/screens/Profile/KnownFollowers.tsx @@ -1,7 +1,6 @@ import {useMemo, useState} from 'react' import {type AppBskyActorDefs} from '@atproto/api' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender' import { @@ -43,7 +42,7 @@ type Props = NativeStackScreenProps< 'ProfileKnownFollowers' > export const ProfileKnownFollowersScreen = ({route}: Props) => { - const {_} = useLingui() + const {t: l} = useLingui() const initialNumToRender = useInitialNumToRender() const {name} = route.params @@ -95,12 +94,12 @@ export const ProfileKnownFollowersScreen = ({route}: Props) => { if (followers.length < 1) { return ( - + { return ( - + ) { const {name: handleOrDid} = route.params const uri = makeRecordUri(handleOrDid, 'app.bsky.labeler.service', 'self') - const {_} = useLingui() + const {t: l} = useLingui() return ( - + ) diff --git a/src/screens/Profile/ProfileSearch.tsx b/src/screens/Profile/ProfileSearch.tsx index 6e65f9b971..5f727dd19e 100644 --- a/src/screens/Profile/ProfileSearch.tsx +++ b/src/screens/Profile/ProfileSearch.tsx @@ -1,6 +1,5 @@ import {useMemo} from 'react' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import { type CommonNavigatorParams, @@ -14,7 +13,7 @@ import {SearchScreenShell} from '#/screens/Search/Shell' type Props = NativeStackScreenProps export const ProfileSearchScreen = ({route}: Props) => { const {name, q: queryParam = ''} = route.params - const {_} = useLingui() + const {t: l} = useLingui() const {currentAccount} = useSession() const {data: resolvedDid} = useResolveDidQuery(name) @@ -33,9 +32,9 @@ export const ProfileSearchScreen = ({route}: Props) => { inputPlaceholder={ profile ? currentAccount?.did === profile.did - ? _(msg`Search my posts`) - : _(msg`Search @${profile.handle}'s posts`) - : _(msg`Search...`) + ? l`Search my posts` + : l`Search @${profile.handle}'s posts` + : l`Search...` } fixedParams={fixedParams} queryParam={queryParam} diff --git a/src/screens/Profile/Sections/Feed.tsx b/src/screens/Profile/Sections/Feed.tsx index c830963922..c7ee5ac11b 100644 --- a/src/screens/Profile/Sections/Feed.tsx +++ b/src/screens/Profile/Sections/Feed.tsx @@ -1,7 +1,6 @@ import {useCallback, useEffect, useImperativeHandle, useState} from 'react' import {View} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {useQueryClient} from '@tanstack/react-query' @@ -52,7 +51,7 @@ export function ProfileFeedSection({ emptyStateIcon, postFeedRef, }: FeedSectionProps) { - const {_} = useLingui() + const {t: l} = useLingui() const queryClient = useQueryClient() const [hasNew, setHasNew] = useState(false) const [isScrolledDown, setIsScrolledDown] = useState(false) @@ -81,12 +80,12 @@ export function ProfileFeedSection({ style={{width: '100%'}} icon={emptyStateIcon || EditIcon} iconSize="3xl" - message={emptyStateMessage || _(msg`No posts yet`)} + message={emptyStateMessage || l`No posts yet`} button={emptyStateButton} /> ) - }, [_, emptyStateButton, emptyStateIcon, emptyStateMessage]) + }, [l, emptyStateButton, emptyStateIcon, emptyStateMessage]) useEffect(() => { if (IS_IOS && isFocused && scrollElRef.current) { @@ -118,7 +117,7 @@ export function ProfileFeedSection({ {(isScrolledDown || hasNew) && ( )} diff --git a/src/screens/Profile/Sections/Labels.tsx b/src/screens/Profile/Sections/Labels.tsx index 8c70d40392..62578466f3 100644 --- a/src/screens/Profile/Sections/Labels.tsx +++ b/src/screens/Profile/Sections/Labels.tsx @@ -6,8 +6,7 @@ import { interpretLabelValueDefinitions, type ModerationOpts, } from '@atproto/api' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {isLabelerSubscribed, lookupLabelValueDefinition} from '#/lib/moderation' @@ -166,7 +165,7 @@ export function LabelerListHeader({ isSubscribed: boolean }) { const t = useTheme() - const {_} = useLingui() + const {t: l} = useLingui() if (isLabelerLoading) { return ( @@ -182,7 +181,7 @@ export function LabelerListHeader({ diff --git a/src/screens/Profile/components/GermButton.tsx b/src/screens/Profile/components/GermButton.tsx index e37e57edbf..052e3159bf 100644 --- a/src/screens/Profile/components/GermButton.tsx +++ b/src/screens/Profile/components/GermButton.tsx @@ -5,8 +5,7 @@ import { type AppBskyActorGetProfile, type AtpAgent, } from '@atproto/api' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {useMutation, useQueryClient} from '@tanstack/react-query' @@ -35,7 +34,7 @@ export function GermButton({ }) { const t = useTheme() const ax = useAnalytics() - const {_} = useLingui() + const {t: l} = useLingui() const {currentAccount} = useSession() const linkWarningControl = Dialog.useDialogControl() @@ -72,7 +71,7 @@ export function GermButton({ return false } }} - label={_(msg`Open Germ DM`)} + label={l`Open Germ DM`} overridePresentation={false} shouldProxy={false} style={[ @@ -117,7 +116,7 @@ function GermLogo({size}: {size: 'small' | 'large'}) { function GermSelfButton({did}: {did: string}) { const t = useTheme() const ax = useAnalytics() - const {_} = useLingui() + const {t: l} = useLingui() const selfExplanationDialogControl = Dialog.useDialogControl() const agent = useAgent() const queryClient = useQueryClient() @@ -157,15 +156,12 @@ function GermSelfButton({did}: {did: string}) { await whenAppViewReady(agent, did, res => !!res.data.associated?.germ) await queryClient.refetchQueries({queryKey: RQKEY(did)}) - Toast.show(_(msg`Germ DM reconnected`)) + Toast.show(l`Germ DM reconnected`) ax.metric('profile:associated:germ:self-reconnect', {}) } catch (e: any) { - Toast.show( - _(msg`Failed to reconnect Germ DM. Error: ${e?.message}`), - { - type: 'error', - }, - ) + Toast.show(l`Failed to reconnect Germ DM. Error: ${e?.message}`, { + type: 'error', + }) if (!isNetworkError(e)) { ax.logger.error('Failed to reconnect Germ DM link', { safeMessage: e, @@ -183,7 +179,7 @@ function GermSelfButton({did}: {did: string}) { Germ DM disconnected {previousRecord && ( - void undo()}> + void undo()}> Undo )} @@ -192,12 +188,9 @@ function GermSelfButton({did}: {did: string}) { }) }, onError: error => { - Toast.show( - _(msg`Failed to disconnect Germ DM. Error: ${error?.message}`), - { - type: 'error', - }, - ) + Toast.show(l`Failed to disconnect Germ DM. Error: ${error?.message}`, { + type: 'error', + }) if (!isNetworkError(error)) { ax.logger.error('Failed to disconnect Germ DM link', { safeMessage: error, @@ -209,7 +202,7 @@ function GermSelfButton({did}: {did: string}) { return ( <> - @@ -250,7 +242,7 @@ function GermSelfButton({did}: {did: string}) { - {noSavedFeedsOfAnyType && ( @@ -229,7 +227,7 @@ function SavedFeedsInner({ expertise.{' '} See this guide @@ -249,7 +247,7 @@ function SavedFeedsA11y({ preferences: UsePreferencesQueryResponse }) { const t = useTheme() - const {_} = useLingui() + const {t: l} = useLingui() const {gtMobile} = useBreakpoints() const {mutateAsync: overwriteSavedFeeds, isPending: isOverwritePending} = useOverwriteSavedFeedsMutation() @@ -268,14 +266,14 @@ function SavedFeedsA11y({ const onSaveChanges = async () => { try { await overwriteSavedFeeds(currentFeeds) - Toast.show(_(msg({message: 'Feeds updated!', context: 'toast'}))) + Toast.show(l({message: 'Feeds updated!', context: 'toast'})) if (navigation.canGoBack()) { navigation.goBack() } else { navigation.navigate('Feeds') } } catch (e) { - Toast.show(_(msg`There was an issue contacting the server`), { + Toast.show(l`There was an issue contacting the server`, { type: 'error', }) logger.error('Failed to toggle pinned feed', {message: e}) @@ -308,7 +306,7 @@ function SavedFeedsA11y({ size="small" color={hasUnsavedChanges ? 'primary' : 'secondary'} onPress={onSaveChanges} - label={_(msg`Save changes`)} + label={l`Save changes`} disabled={isOverwritePending || !hasUnsavedChanges}> @@ -316,7 +314,6 @@ function SavedFeedsA11y({ - {noSavedFeedsOfAnyType && ( @@ -400,7 +397,7 @@ function SavedFeedsA11y({ expertise.{' '} See this guide @@ -435,7 +432,7 @@ function PinnedFeedItem({ onMoveUp?: () => void onMoveDown?: () => void }) { - const {_} = useLingui() + const {t: l} = useLingui() const t = useTheme() const playHaptic = useHaptics() const feedUri = feed.value @@ -464,7 +461,7 @@ function PinnedFeedItem({ ), - [control, _], + [control, l], ) return ( @@ -105,8 +104,8 @@ function ChangeHandleDialogInner() { {serviceInfoError ? ( @@ -150,7 +149,7 @@ function ProvidedHandlePage({ serviceInfo: ComAtprotoServerDescribeServer.OutputSchema goToOwnHandle: () => void }) { - const {_} = useLingui() + const {t: l} = useLingui() const [subdomain, setSubdomain] = useState('') const agent = useAgent() const control = Dialog.useDialogContext() @@ -194,7 +193,7 @@ function ProvidedHandlePage({ {isSuccess && ( - + )} {error && ( @@ -211,12 +210,10 @@ function ProvidedHandlePage({ You are verified. You will lose your verification status if you change your handle.{' '} Learn more. @@ -233,8 +230,8 @@ function ProvidedHandlePage({ editable={!isPending} defaultValue={subdomain} onChangeText={text => setSubdomain(text)} - label={_(msg`New handle`)} - placeholder={_(msg`e.g. alice`)} + label={l`New handle`} + placeholder={l`e.g. alice`} autoCapitalize="none" autoCorrect={false} /> @@ -252,7 +249,7 @@ function ProvidedHandlePage({ {IS_NATIVE && ( - {error && ( (null) const t = useTheme() - const {_} = useLingui() + const {t: l} = useLingui() const cleanError = useCleanError() const agent = useAgent() const {currentAccount} = useSession() @@ -125,7 +124,7 @@ function DeleteAccountDialogInner({ token, }) control.close(() => { - toast.show(_(msg`Your account has been deleted, see ya! ✌️`)) + toast.show(l`Your account has been deleted, see ya! ✌️`) resetToTab('HomeTab') removeAccount(currentAccount) }) @@ -141,7 +140,7 @@ function DeleteAccountDialogInner({ setStep(Step.VERIFY_CODE) } }, [ - _, + l, agent, cleanError, confirmCode, @@ -180,7 +179,7 @@ function DeleteAccountDialogInner({ <> - {_(msg`Delete account “${currentHandle}”`)} + {l`Delete account “${currentHandle}”`} @@ -196,7 +195,7 @@ function DeleteAccountDialogInner({ @@ -211,7 +210,7 @@ function DeleteAccountDialogInner({ You can also{' '} temporarily deactivate {' '} @@ -227,7 +226,7 @@ function DeleteAccountDialogInner({ <> - {_(msg`Delete account “${currentHandle}”`)} + {l`Delete account “${currentHandle}”`} @@ -260,7 +259,7 @@ function DeleteAccountDialogInner({ Email sent!{' '} Click here to resend. @@ -269,7 +268,7 @@ function DeleteAccountDialogInner({ Don’t see a code?{' '} Click here to resend. @@ -288,7 +287,7 @@ function DeleteAccountDialogInner({ @@ -324,7 +323,7 @@ function DeleteAccountDialogInner({ <> - {_(msg`Are you really, really sure?`)} + {l`Are you really, really sure?`} @@ -335,7 +334,7 @@ function DeleteAccountDialogInner({ and all associated data. Note that this will affect any other{' '} + label={l`AT Protocol FAQ`}> AT Protocol {' '} services you use with this account. @@ -345,7 +344,7 @@ function DeleteAccountDialogInner({ diff --git a/src/screens/Settings/components/DisableEmail2FADialog.tsx b/src/screens/Settings/components/DisableEmail2FADialog.tsx index 8b774b54f7..caba45f7d1 100644 --- a/src/screens/Settings/components/DisableEmail2FADialog.tsx +++ b/src/screens/Settings/components/DisableEmail2FADialog.tsx @@ -1,7 +1,6 @@ import {useState} from 'react' import {View} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {cleanError} from '#/lib/strings/errors' @@ -27,7 +26,7 @@ export function DisableEmail2FADialog({ }: { control: Dialog.DialogOuterProps['control'] }) { - const {_} = useLingui() + const {t: l} = useLingui() const t = useTheme() const {gtMobile} = useBreakpoints() const {currentAccount} = useSession() @@ -62,13 +61,13 @@ export function DisableEmail2FADialog({ emailAuthFactor: false, }) await agent.resumeSession(agent.session!) - Toast.show(_(msg({message: 'Email 2FA disabled', context: 'toast'}))) + Toast.show(l({message: 'Email 2FA disabled', context: 'toast'})) } control.close() } catch (e) { const errMsg = String(e) if (errMsg.includes('Token is invalid')) { - setError(_(msg`Invalid 2FA confirmation code.`)) + setError(l`Invalid 2FA confirmation code.`) } else { setError(cleanError(errMsg)) } @@ -118,7 +117,7 @@ export function DisableEmail2FADialog({ color="primary" size={gtMobile ? 'small' : 'large'} onPress={onSendEmail} - label={_(msg`Send verification email`)} + label={l`Send verification email`} disabled={isProcessing}> Send verification email @@ -131,7 +130,7 @@ export function DisableEmail2FADialog({ color="primary" size={gtMobile ? 'small' : 'large'} onPress={() => setStage(Stages.ConfirmCode)} - label={_(msg`I have a code`)} + label={l`I have a code`} disabled={isProcessing}> I have a code @@ -148,7 +147,7 @@ export function DisableEmail2FADialog({ Resend email @@ -183,7 +182,7 @@ export function DisableEmail2FADialog({ color="primary" size={gtMobile ? 'small' : 'large'} onPress={onConfirmDisable} - label={_(msg`Confirm`)} + label={l`Confirm`} disabled={isProcessing}> Confirm diff --git a/src/screens/Settings/components/Email2FAToggle.tsx b/src/screens/Settings/components/Email2FAToggle.tsx index 32c886278e..f336f93ea6 100644 --- a/src/screens/Settings/components/Email2FAToggle.tsx +++ b/src/screens/Settings/components/Email2FAToggle.tsx @@ -1,6 +1,5 @@ import {useCallback} from 'react' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {useSession} from '#/state/session' import {useDialogControl} from '#/components/Dialog' @@ -12,7 +11,7 @@ import {DisableEmail2FADialog} from './DisableEmail2FADialog' import * as SettingsList from './SettingsList' export function Email2FAToggle() { - const {_} = useLingui() + const {t: l} = useLingui() const {currentAccount} = useSession() const disableDialogControl = useDialogControl() const emailDialogControl = useEmailDialogControl() @@ -27,9 +26,7 @@ export function Email2FAToggle() { <> diff --git a/src/screens/Settings/components/OTAInfo.tsx b/src/screens/Settings/components/OTAInfo.tsx index 9ab1962b97..0cadbf449f 100644 --- a/src/screens/Settings/components/OTAInfo.tsx +++ b/src/screens/Settings/components/OTAInfo.tsx @@ -1,6 +1,5 @@ import * as Updates from 'expo-updates' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {useMutation, useQuery} from '@tanstack/react-query' @@ -12,7 +11,7 @@ import * as Toast from '#/components/Toast' import * as SettingsList from '../components/SettingsList' export function OTAInfo() { - const {_} = useLingui() + const {t: l} = useLingui() const { data: isAvailable, isPending: isPendingInfo, @@ -58,7 +57,7 @@ export function OTAInfo() { )} - diff --git a/src/view/com/composer/drafts/DraftsButton.tsx b/src/view/com/composer/drafts/DraftsButton.tsx index 11628544b6..1d1fb5789f 100644 --- a/src/view/com/composer/drafts/DraftsButton.tsx +++ b/src/view/com/composer/drafts/DraftsButton.tsx @@ -1,5 +1,4 @@ -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {atoms as a} from '#/alf' @@ -30,7 +29,7 @@ export function DraftsButton({ canSaveDraft: boolean textLength: number }) { - const {_} = useLingui() + const {t: l} = useLingui() const ax = useAnalytics() const draftsDialogControl = Dialog.useDialogControl() const savePromptControl = Prompt.usePromptControl() @@ -67,7 +66,7 @@ export function DraftsButton({ return ( <> - - @@ -122,17 +119,17 @@ export function DraftsButton({ {canSaveDraft && ( )} - + diff --git a/src/view/com/composer/drafts/DraftsListDialog.tsx b/src/view/com/composer/drafts/DraftsListDialog.tsx index 30525f5cbc..f5acfffa43 100644 --- a/src/view/com/composer/drafts/DraftsListDialog.tsx +++ b/src/view/com/composer/drafts/DraftsListDialog.tsx @@ -1,7 +1,6 @@ import {useCallback, useEffect, useMemo} from 'react' import {Keyboard, View} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {useCallOnce} from '#/lib/once' @@ -26,7 +25,7 @@ export function DraftsListDialog({ control: Dialog.DialogControlProps onSelectDraft: (draft: DraftSummary) => void }) { - const {_} = useLingui() + const {t: l} = useLingui() const t = useTheme() const {gtPhone} = useBreakpoints() const ax = useAnalytics() @@ -84,7 +83,7 @@ export function DraftsListDialog({ const backButton = useCallback( () => ( ), - [control, _], + [control, l], ) const renderItem = useCallback( @@ -140,11 +139,11 @@ export function DraftsListDialog({ return ( ) - }, [isLoading, _]) + }, [isLoading, l]) const footerComponent = useMemo( () => ( diff --git a/src/view/com/composer/labels/LabelsBtn.tsx b/src/view/com/composer/labels/LabelsBtn.tsx index 9471dc0d2e..6650b2bbd7 100644 --- a/src/view/com/composer/labels/LabelsBtn.tsx +++ b/src/view/com/composer/labels/LabelsBtn.tsx @@ -1,6 +1,5 @@ import {Keyboard, View} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import { @@ -28,7 +27,7 @@ export function LabelsBtn({ onChange: (v: SelfLabel[]) => void }) { const control = Dialog.useDialogControl() - const {_} = useLingui() + const {t: l} = useLingui() const hasLabel = labels.length > 0 @@ -58,10 +57,8 @@ export function LabelsBtn({ Keyboard.dismiss() control.open() }} - label={_(msg`Content warnings`)} - accessibilityHint={_( - msg`Opens a dialog to add a content warning to your post`, - )}> + label={l`Content warnings`} + accessibilityHint={l`Opens a dialog to add a content warning to your post`}> {labels.length > 0 ? ( @@ -72,7 +69,6 @@ export function LabelsBtn({ - void updateOtherLabels: (labels: OtherSelfLabel[]) => void }) { - const {_} = useLingui() + const {t: l} = useLingui() const control = Dialog.useDialogContext() const t = useTheme() return ( @@ -131,25 +127,25 @@ function DialogInner({ t.atoms.border_contrast_medium, ]}> { updateAdultLabels(values as AdultSelfLabel[]) }}> - + Suggestive - + Nudity - + Adult @@ -189,12 +185,12 @@ function DialogInner({ t.atoms.border_contrast_medium, ]}> { updateOtherLabels(values as OtherSelfLabel[]) }}> - + Graphic Media @@ -213,10 +209,9 @@ function DialogInner({ - ), - [control, _, pending], + [control, l, pending], ) const saveButton = useCallback( () => ( ), - [_, pending], + [l, pending], ) return ( diff --git a/src/view/com/composer/photos/Gallery.tsx b/src/view/com/composer/photos/Gallery.tsx index 98bfac779d..7341909745 100644 --- a/src/view/com/composer/photos/Gallery.tsx +++ b/src/view/com/composer/photos/Gallery.tsx @@ -11,8 +11,7 @@ import { type ViewStyle, } from 'react-native' import {Image} from 'expo-image' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries' @@ -154,7 +153,7 @@ const GalleryItem = ({ onChange, onRemove, }: GalleryItemProps): React.ReactNode => { - const {_} = useLingui() + const {t: l} = useLingui() const t = useTheme() const ax = useAnalytics() @@ -198,7 +197,7 @@ const GalleryItem = ({ @@ -215,7 +214,7 @@ const GalleryItem = ({ @@ -224,7 +223,7 @@ const GalleryItem = ({ @@ -233,12 +232,11 @@ const GalleryItem = ({ - - - - { - const {_, i18n} = useLingui() + const {t: l, i18n} = useLingui() const t = useTheme() const {width: screenWidth} = useWindowDimensions() @@ -92,9 +91,8 @@ const ImageAltTextInner = ({ }, [image, screenWidth]) return ( - + - {/* vertical space is too precious - gets scrolled out of the way anyway */} {IS_WEB && ( @@ -116,7 +114,6 @@ const ImageAltTextInner = ({ /> - @@ -125,7 +122,7 @@ const ImageAltTextInner = ({ { setAltText(text) }} @@ -160,7 +157,7 @@ const ImageAltTextInner = ({ - - + {({props}) => ( { setLangPrefs.setPostLanguage(historyItem) onSelectLanguage?.(historyItem) @@ -122,7 +121,7 @@ export function PostLanguageSelect({ More languages... @@ -131,7 +130,6 @@ export function PostLanguageSelect({ - Choose post languages} subtitleText={Select up to 3 languages used in this post} @@ -157,7 +155,7 @@ function LanguageBtn({ }) { const t = useTheme() const ax = useAnalytics() - const {_} = useLingui() + const {t: l} = useLingui() const langPrefs = useLanguagePrefs() const postLanguagesPref = toPostLanguages(langPrefs.postLanguage) @@ -191,13 +189,11 @@ function LanguageBtn({ testID="selectLangBtn" size="small" hitSlop={LANG_DROPDOWN_HITSLOP} - label={_( - msg({ - message: `Post language selection`, - comment: `Accessibility label for button that opens dialog to choose post language settings`, - }), - )} - accessibilityHint={_(msg`Opens post language settings`)} + label={l({ + message: `Post language selection`, + comment: `Accessibility label for button that opens dialog to choose post language settings`, + })} + accessibilityHint={l`Opens post language settings`} style={[a.mr_xs, a.overflow_hidden]} {...props} onPress={e => { diff --git a/src/view/com/composer/videos/SubtitleDialog.tsx b/src/view/com/composer/videos/SubtitleDialog.tsx index 237f842406..8994346883 100644 --- a/src/view/com/composer/videos/SubtitleDialog.tsx +++ b/src/view/com/composer/videos/SubtitleDialog.tsx @@ -1,7 +1,6 @@ import {useCallback, useState} from 'react' import {Keyboard, type StyleProp, View, type ViewStyle} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Plural, Trans} from '@lingui/react/macro' import {MAX_ALT_TEXT} from '#/lib/constants' @@ -33,16 +32,16 @@ interface Props { export function SubtitleDialogBtn(props: Props) { const control = Dialog.useDialogControl() - const {_} = useLingui() + const {t: l} = useLingui() return ( - @@ -113,7 +111,7 @@ function DialogInner({ }) { const control = Dialog.useDialogContext() const t = useTheme() - const {_} = useLingui() + const {t: l} = useLingui() const atUri = new AtUri(uri) const {data: profile, isError: isProfileError} = useProfileQuery({ did: atUri.host, @@ -123,9 +121,7 @@ function DialogInner({ return ( @@ -208,7 +204,7 @@ function DialogInner({ {IS_NATIVE && ( ) : ( @@ -613,12 +609,10 @@ let PreviewableUserAvatar = ({ ) : ( void }) { const t = useTheme() - const {_} = useLingui() + const {t: l} = useLingui() const {requestCameraAccessIfNeeded} = useCameraPermission() const {requestPhotoAccessIfNeeded} = usePhotoLibraryPermission() const sheetWrapper = useSheetWrapper() @@ -122,7 +121,7 @@ export function UserBanner({ <> - + {({props}) => ( {banner ? ( @@ -161,7 +160,7 @@ export function UserBanner({ {IS_NATIVE && ( Upload from Camera @@ -172,7 +171,7 @@ export function UserBanner({ {IS_NATIVE ? ( @@ -190,7 +189,7 @@ export function UserBanner({ Remove Banner diff --git a/src/view/com/util/error/ErrorScreen.tsx b/src/view/com/util/error/ErrorScreen.tsx index e37d686f18..947bcf8ce1 100644 --- a/src/view/com/util/error/ErrorScreen.tsx +++ b/src/view/com/util/error/ErrorScreen.tsx @@ -1,6 +1,5 @@ import {View} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {usePalette} from '#/lib/hooks/usePalette' @@ -28,7 +27,7 @@ export function ErrorScreen({ }) { const t = useTheme() const pal = usePalette('default') - const {_} = useLingui() + const {t: l} = useLingui() return ( @@ -88,10 +87,8 @@ export function ErrorScreen({ variant="solid" color="secondary_inverted" size="small" - label={_(msg`Retry`)} - accessibilityHint={_( - msg`Retries the last action, which errored out`, - )}> + label={l`Retry`} + accessibilityHint={l`Retries the last action, which errored out`}> Try again diff --git a/src/view/screens/CommunityGuidelines.tsx b/src/view/screens/CommunityGuidelines.tsx index fa947be3da..a46e1de10c 100644 --- a/src/view/screens/CommunityGuidelines.tsx +++ b/src/view/screens/CommunityGuidelines.tsx @@ -1,6 +1,5 @@ import {View} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {usePalette} from '#/lib/hooks/usePalette' @@ -21,11 +20,11 @@ type Props = NativeStackScreenProps< > export const CommunityGuidelinesScreen = (_props: Props) => { const pal = usePalette('default') - const {_} = useLingui() + const {t: l} = useLingui() return ( - + diff --git a/src/view/screens/CopyrightPolicy.tsx b/src/view/screens/CopyrightPolicy.tsx index 00d7d454fb..332fb2f197 100644 --- a/src/view/screens/CopyrightPolicy.tsx +++ b/src/view/screens/CopyrightPolicy.tsx @@ -1,6 +1,5 @@ import {View} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {usePalette} from '#/lib/hooks/usePalette' @@ -18,11 +17,11 @@ import {ViewHeader} from '../com/util/ViewHeader' type Props = NativeStackScreenProps export const CopyrightPolicyScreen = (_props: Props) => { const pal = usePalette('default') - const {_} = useLingui() + const {t: l} = useLingui() return ( - + diff --git a/src/view/screens/DebugMod.tsx b/src/view/screens/DebugMod.tsx index c3fe8fba8e..596c95ccce 100644 --- a/src/view/screens/DebugMod.tsx +++ b/src/view/screens/DebugMod.tsx @@ -17,8 +17,7 @@ import { type ModerationOpts, RichText, } from '@atproto/api' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {useGlobalLabelStrings} from '#/lib/moderation/useGlobalLabelStrings' import { @@ -948,12 +947,12 @@ function MockAccountScreen({ moderationOpts: ModerationOpts }) { const t = useTheme() - const {_} = useLingui() + const {t: l} = useLingui() return ( - {hasSession && ( } accessibilityRole="button" - accessibilityLabel={_(msg`New post`)} + accessibilityLabel={l`New post`} accessibilityHint="" /> )} @@ -560,7 +558,7 @@ function FeedOrFollowing({savedFeed}: {savedFeed: SavedFeedItem}) { function FollowingFeed() { const t = useTheme() - const {_} = useLingui() + const {t: l} = useLingui() return ( diff --git a/src/view/screens/Lists.tsx b/src/view/screens/Lists.tsx index 54f3568fc0..4da3d86077 100644 --- a/src/view/screens/Lists.tsx +++ b/src/view/screens/Lists.tsx @@ -1,7 +1,6 @@ import {useCallback} from 'react' import {AtUri} from '@atproto/api' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {useNavigation} from '@react-navigation/native' @@ -21,7 +20,7 @@ import * as Layout from '#/components/Layout' type Props = NativeStackScreenProps export function ListsScreen({}: Props) { - const {_} = useLingui() + const {t: l} = useLingui() const navigation = useNavigation() const requireEmailVerification = useRequireEmailVerification() const createListDialogControl = useDialogControl() @@ -61,7 +60,7 @@ export function ListsScreen({}: Props) { - - export function ModerationModlistsScreen({}: Props) { - const {_} = useLingui() + const {t: l} = useLingui() const navigation = useNavigation() const requireEmailVerification = useRequireEmailVerification() const createListDialogControl = useDialogControl() @@ -61,7 +60,7 @@ export function ModerationModlistsScreen({}: Props) { - - export function NotificationsScreen({}: Props) { - const {_} = useLingui() + const {t: l} = useLingui() const t = useTheme() const {openComposer} = useOpenComposer() const unreadNotifs = useUnreadNotifications() @@ -83,7 +82,7 @@ export function NotificationsScreen({}: Props) { const sections = useMemo(() => { return [ { - title: _(msg`All`), + title: l`All`, component: ( openComposer({logContext: 'Fab'})} icon={} accessibilityRole="button" - accessibilityLabel={_(msg`New post`)} + accessibilityLabel={l`New post`} accessibilityHint="" /> @@ -184,7 +183,7 @@ function NotificationsTab({ checkUnread: ({invalidate}: {invalidate: boolean}) => Promise setIsLoadingLatest: (v: boolean) => void }) { - const {_} = useLingui() + const {t: l} = useLingui() const [isScrolledDown, setIsScrolledDown] = useState(false) const scrollElRef = useRef(null) const queryClient = useQueryClient() @@ -268,7 +267,7 @@ function NotificationsTab({ {(isScrolledDown || hasNew) && ( )} @@ -278,7 +277,7 @@ function NotificationsTab({ function DisabledNotificationsWarning({active}: {active: boolean}) { const t = useTheme() - const {_} = useLingui() + const {t: l} = useLingui() const {data} = useNotificationSettingsQuery({enabled: active}) if (!data) return null @@ -293,7 +292,7 @@ function DisabledNotificationsWarning({active}: {active: boolean}) { notifications, so this tab will no longer update. To adjust this, visit your{' '} notification settings diff --git a/src/view/screens/PrivacyPolicy.tsx b/src/view/screens/PrivacyPolicy.tsx index 7853c1bd7a..e97502afb9 100644 --- a/src/view/screens/PrivacyPolicy.tsx +++ b/src/view/screens/PrivacyPolicy.tsx @@ -1,6 +1,5 @@ import {View} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {usePalette} from '#/lib/hooks/usePalette' @@ -18,11 +17,11 @@ import {ViewHeader} from '../com/util/ViewHeader' type Props = NativeStackScreenProps export const PrivacyPolicyScreen = (_props: Props) => { const pal = usePalette('default') - const {_} = useLingui() + const {t: l} = useLingui() return ( - + diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx index ead74bae94..a1a0a3c092 100644 --- a/src/view/screens/Profile.tsx +++ b/src/view/screens/Profile.tsx @@ -8,8 +8,7 @@ import { type ModerationOpts, RichText as RichTextAPI, } from '@atproto/api' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {useFocusEffect, useNavigation} from '@react-navigation/native' import {useQueryClient} from '@tanstack/react-query' @@ -70,7 +69,7 @@ export function ProfileScreen(props: Props) { } function ProfileScreenInner({route}: Props) { - const {_} = useLingui() + const {t: l} = useLingui() const {currentAccount} = useSession() const queryClient = useQueryClient() const name = @@ -130,7 +129,7 @@ function ProfileScreenInner({route}: Props) { (null) @@ -231,16 +230,16 @@ function ProfileScreenLoaded({ const showListsTab = hasSession && (isMe || listCount > 0) const sectionTitles = [ - showFiltersTab ? _(msg`Labels`) : undefined, - showListsTab && hasLabeler ? _(msg`Lists`) : undefined, - showPostsTab ? _(msg`Posts`) : undefined, - showRepliesTab ? _(msg`Replies`) : undefined, - showMediaTab ? _(msg`Media`) : undefined, - showVideosTab ? _(msg`Videos`) : undefined, - showLikesTab ? _(msg`Likes`) : undefined, - showFeedsTab ? _(msg`Feeds`) : undefined, - showStarterPacksTab ? _(msg`Starter Packs`) : undefined, - showListsTab && !hasLabeler ? _(msg`Lists`) : undefined, + showFiltersTab ? l`Labels` : undefined, + showListsTab && hasLabeler ? l`Lists` : undefined, + showPostsTab ? l`Posts` : undefined, + showRepliesTab ? l`Replies` : undefined, + showMediaTab ? l`Media` : undefined, + showVideosTab ? l`Videos` : undefined, + showLikesTab ? l`Likes` : undefined, + showFeedsTab ? l`Feeds` : undefined, + showStarterPacksTab ? l`Starter Packs` : undefined, + showListsTab && !hasLabeler ? l`Lists` : undefined, ].filter(Boolean) as string[] let nextIndex = 0 @@ -393,7 +392,7 @@ function ProfileScreenLoaded({ openComposer({logContext: 'ProfileFeed'}), size: 'small', @@ -467,7 +466,7 @@ function ProfileScreenLoaded({ scrollElRef={scrollElRef as ListRef} ignoreFilterFor={profile.did} setScrollViewTag={setScrollViewTag} - emptyStateMessage={_(msg`No replies yet`)} + emptyStateMessage={l`No replies yet`} emptyStateIcon={MessageIcon} /> ) @@ -482,12 +481,12 @@ function ProfileScreenLoaded({ scrollElRef={scrollElRef as ListRef} ignoreFilterFor={profile.did} setScrollViewTag={setScrollViewTag} - emptyStateMessage={_(msg`No media yet`)} + emptyStateMessage={l`No media yet`} emptyStateButton={ isMe ? { - label: _(msg`Post a photo`), - text: _(msg`Post a photo`), + label: l`Post a photo`, + text: l`Post a photo`, onPress: () => openComposer({logContext: 'ProfileFeed'}), size: 'small', @@ -509,12 +508,12 @@ function ProfileScreenLoaded({ scrollElRef={scrollElRef as ListRef} ignoreFilterFor={profile.did} setScrollViewTag={setScrollViewTag} - emptyStateMessage={_(msg`No video posts yet`)} + emptyStateMessage={l`No video posts yet`} emptyStateButton={ isMe ? { - label: _(msg`Post a video`), - text: _(msg`Post a video`), + label: l`Post a video`, + text: l`Post a video`, onPress: () => openComposer({logContext: 'ProfileFeed'}), size: 'small', @@ -536,7 +535,7 @@ function ProfileScreenLoaded({ scrollElRef={scrollElRef as ListRef} ignoreFilterFor={profile.did} setScrollViewTag={setScrollViewTag} - emptyStateMessage={_(msg`No likes yet`)} + emptyStateMessage={l`No likes yet`} emptyStateIcon={HeartIcon} /> ) @@ -565,16 +564,14 @@ function ProfileScreenLoaded({ setScrollViewTag={setScrollViewTag} emptyStateMessage={ isMe - ? _( - msg`Starter Packs let you share your favorite feeds and people with your friends.`, - ) - : _(msg`No Starter Packs yet`) + ? l`Starter Packs let you share your favorite feeds and people with your friends.` + : l`No Starter Packs yet` } emptyStateButton={ isMe ? { - label: _(msg`Create a Starter Pack`), - text: _(msg`Create a Starter Pack`), + label: l`Create a Starter Pack`, + text: l`Create a Starter Pack`, onPress: wrappedNavToWizard, color: 'primary', size: 'small', @@ -604,7 +601,7 @@ function ProfileScreenLoaded({ onPress={onPressCompose} icon={} accessibilityRole="button" - accessibilityLabel={_(msg`New post`)} + accessibilityLabel={l`New post`} accessibilityHint="" /> )} diff --git a/src/view/screens/Storybook/Admonitions.tsx b/src/view/screens/Storybook/Admonitions.tsx index de356dbf89..2116dbe30c 100644 --- a/src/view/screens/Storybook/Admonitions.tsx +++ b/src/view/screens/Storybook/Admonitions.tsx @@ -1,6 +1,5 @@ import {Text as RNText, View} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {atoms as a, useTheme} from '#/alf' @@ -20,13 +19,12 @@ import {InlineLinkText} from '#/components/Link' import {H1} from '#/components/Typography' export function Admonitions() { - const {_} = useLingui() + const {t: l} = useLingui() const t = useTheme() return (

Admonitions

- The quick brown fox jumps over the lazy dog. How happy the blameless vestal's lot, the world forgetting by the world @@ -47,7 +45,6 @@ export function Admonitions() { The quick brown fox jumps over the lazy dog. - @@ -58,7 +55,7 @@ export function Admonitions() { {}}> Retry @@ -67,7 +64,6 @@ export function Admonitions() { - @@ -91,7 +87,7 @@ export function Admonitions() { If you want to restrict who can receive notifications for your account's activity, you can change this in{' '} Settings → Privacy and Security diff --git a/src/view/screens/Support.tsx b/src/view/screens/Support.tsx index 3fbad73e40..e95c1a0746 100644 --- a/src/view/screens/Support.tsx +++ b/src/view/screens/Support.tsx @@ -1,5 +1,4 @@ -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {HELP_DESK_URL} from '#/lib/constants' @@ -18,11 +17,11 @@ import * as Layout from '#/components/Layout' type Props = NativeStackScreenProps export const SupportScreen = (_props: Props) => { const pal = usePalette('default') - const {_} = useLingui() + const {t: l} = useLingui() return ( - + Support @@ -32,7 +31,7 @@ export const SupportScreen = (_props: Props) => { The support form has been moved. If you need help, please{' '} {' '} or visit {HELP_DESK_URL} to get in touch with us. diff --git a/src/view/screens/TermsOfService.tsx b/src/view/screens/TermsOfService.tsx index 08e93188ba..2bc19af8de 100644 --- a/src/view/screens/TermsOfService.tsx +++ b/src/view/screens/TermsOfService.tsx @@ -1,6 +1,5 @@ import {View} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {usePalette} from '#/lib/hooks/usePalette' @@ -18,11 +17,11 @@ import {ViewHeader} from '../com/util/ViewHeader' type Props = NativeStackScreenProps export const TermsOfServiceScreen = (_props: Props) => { const pal = usePalette('default') - const {_} = useLingui() + const {t: l} = useLingui() return ( - + diff --git a/src/view/shell/Drawer.tsx b/src/view/shell/Drawer.tsx index 358759f379..6f42b8e727 100644 --- a/src/view/shell/Drawer.tsx +++ b/src/view/shell/Drawer.tsx @@ -7,8 +7,8 @@ import { View, } from 'react-native' import {useSafeAreaInsets} from 'react-native-safe-area-context' -import {msg, plural} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {plural} from '@lingui/core/macro' +import {useLingui} from '@lingui/react/macro' import {Plural, Trans} from '@lingui/react/macro' import {StackActions, useNavigation} from '@react-navigation/native' @@ -80,7 +80,7 @@ let DrawerProfileCard = ({ onPressProfile: () => void onPressShare?: () => void }): React.ReactNode => { - const {_, i18n} = useLingui() + const {t: l, i18n} = useLingui() const t = useTheme() const {data: profile} = useProfileQuery({did: account.did}) const {isActive: live} = useActorStatus(profile) @@ -88,8 +88,8 @@ let DrawerProfileCard = ({ return ( [ @@ -399,7 +397,7 @@ let DrawerFooter = ({ onPressFeedback: () => void onPressHelp: () => void }): React.ReactNode => { - const {_} = useLingui() + const {t: l} = useLingui() const insets = useSafeAreaInsets() return ( - diff --git a/src/view/shell/bottom-bar/BottomBarWeb.tsx b/src/view/shell/bottom-bar/BottomBarWeb.tsx index 3cb1984fca..de25c20664 100644 --- a/src/view/shell/bottom-bar/BottomBarWeb.tsx +++ b/src/view/shell/bottom-bar/BottomBarWeb.tsx @@ -1,8 +1,8 @@ import {useCallback} from 'react' import {View} from 'react-native' import Animated from 'react-native-reanimated' -import {msg, plural} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' +import {plural} from '@lingui/core/macro' +import {useLingui} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro' import {useNavigationState} from '@react-navigation/native' @@ -50,7 +50,7 @@ import {styles} from './BottomBarStyles' type NavItemValue = 'home' | 'search' | 'chat' | 'notifications' | 'profile' export function BottomBarWeb() { - const {_} = useLingui() + const {t: l} = useLingui() const {hasSession, currentAccount} = useSession() const t = useTheme() const footerMinimalShellTransform = useMinimalShellFooterTransform() @@ -85,7 +85,6 @@ export function BottomBarWeb() { return ( <> -