diff --git a/src/App.native.tsx b/src/App.native.tsx index 6402b4a8..9de90176 100644 --- a/src/App.native.tsx +++ b/src/App.native.tsx @@ -39,6 +39,8 @@ import { import {Provider as UnreadNotifsProvider} from 'state/queries/notifications/unread' import * as persisted from '#/state/persisted' import {Splash} from '#/Splash' +import {msg} from '@lingui/macro' +import {useLingui} from '@lingui/react' SplashScreen.preventAutoHideAsync() @@ -46,17 +48,18 @@ function InnerApp() { const colorMode = useColorMode() const {isInitialLoad, currentAccount} = useSession() const {resumeSession} = useSessionApi() + const {_} = useLingui() // init useEffect(() => { notifications.init(queryClient) listenSessionDropped(() => { - Toast.show('Sorry! Your session expired. Please log in again.') + Toast.show(_(msg`Sorry! Your session expired. Please log in again.`)) }) const account = persisted.get('session').currentAccount resumeSession(account) - }, [resumeSession]) + }, [resumeSession, _]) return ( diff --git a/src/Navigation.tsx b/src/Navigation.tsx index 76a893c6..c68cb058 100644 --- a/src/Navigation.tsx +++ b/src/Navigation.tsx @@ -76,6 +76,8 @@ import {PreferencesHomeFeed} from 'view/screens/PreferencesHomeFeed' import {PreferencesThreads} from 'view/screens/PreferencesThreads' import {PreferencesExternalEmbeds} from '#/view/screens/PreferencesExternalEmbeds' import {createNativeStackNavigatorWithAuth} from './view/shell/createNativeStackNavigatorWithAuth' +import {msg} from '@lingui/macro' +import {i18n, MessageDescriptor} from '@lingui/core' const navigationRef = createNavigationContainerRef() @@ -93,55 +95,56 @@ const Tab = createBottomTabNavigator() * These "common screens" are reused across stacks. */ function commonScreens(Stack: typeof HomeTab, unreadCountLabel?: string) { - const title = (page: string) => bskyTitle(page, unreadCountLabel) + const title = (page: MessageDescriptor) => + bskyTitle(i18n._(page), unreadCountLabel) return ( <> NotFoundScreen} - options={{title: title('Not Found')}} + options={{title: title(msg`Not Found`)}} /> ModerationScreen} - options={{title: title('Moderation'), requireAuth: true}} + options={{title: title(msg`Moderation`), requireAuth: true}} /> ModerationModlistsScreen} - options={{title: title('Moderation Lists'), requireAuth: true}} + options={{title: title(msg`Moderation Lists`), requireAuth: true}} /> ModerationMutedAccounts} - options={{title: title('Muted Accounts'), requireAuth: true}} + options={{title: title(msg`Muted Accounts`), requireAuth: true}} /> ModerationBlockedAccounts} - options={{title: title('Blocked Accounts'), requireAuth: true}} + options={{title: title(msg`Blocked Accounts`), requireAuth: true}} /> SettingsScreen} - options={{title: title('Settings'), requireAuth: true}} + options={{title: title(msg`Settings`), requireAuth: true}} /> LanguageSettingsScreen} - options={{title: title('Language Settings'), requireAuth: true}} + options={{title: title(msg`Language Settings`), requireAuth: true}} /> ProfileScreen} options={({route}) => ({ - title: title(`@${route.params.name}`), + title: title(msg`@${route.params.name}`), animation: 'none', })} /> @@ -149,106 +152,112 @@ function commonScreens(Stack: typeof HomeTab, unreadCountLabel?: string) { name="ProfileFollowers" getComponent={() => ProfileFollowersScreen} options={({route}) => ({ - title: title(`People following @${route.params.name}`), + title: title(msg`People following @${route.params.name}`), })} /> ProfileFollowsScreen} options={({route}) => ({ - title: title(`People followed by @${route.params.name}`), + title: title(msg`People followed by @${route.params.name}`), })} /> ProfileListScreen} - options={{title: title('List'), requireAuth: true}} + options={{title: title(msg`List`), requireAuth: true}} /> PostThreadScreen} - options={({route}) => ({title: title(`Post by @${route.params.name}`)})} + options={({route}) => ({ + title: title(msg`Post by @${route.params.name}`), + })} /> PostLikedByScreen} - options={({route}) => ({title: title(`Post by @${route.params.name}`)})} + options={({route}) => ({ + title: title(msg`Post by @${route.params.name}`), + })} /> PostRepostedByScreen} - options={({route}) => ({title: title(`Post by @${route.params.name}`)})} + options={({route}) => ({ + title: title(msg`Post by @${route.params.name}`), + })} /> ProfileFeedScreen} - options={{title: title('Feed'), requireAuth: true}} + options={{title: title(msg`Feed`), requireAuth: true}} /> ProfileFeedLikedByScreen} - options={{title: title('Liked by')}} + options={{title: title(msg`Liked by`)}} /> DebugScreen} - options={{title: title('Debug'), requireAuth: true}} + options={{title: title(msg`Debug`), requireAuth: true}} /> LogScreen} - options={{title: title('Log'), requireAuth: true}} + options={{title: title(msg`Log`), requireAuth: true}} /> SupportScreen} - options={{title: title('Support')}} + options={{title: title(msg`Support`)}} /> PrivacyPolicyScreen} - options={{title: title('Privacy Policy')}} + options={{title: title(msg`Privacy Policy`)}} /> TermsOfServiceScreen} - options={{title: title('Terms of Service')}} + options={{title: title(msg`Terms of Service`)}} /> CommunityGuidelinesScreen} - options={{title: title('Community Guidelines')}} + options={{title: title(msg`Community Guidelines`)}} /> CopyrightPolicyScreen} - options={{title: title('Copyright Policy')}} + options={{title: title(msg`Copyright Policy`)}} /> AppPasswords} - options={{title: title('App Passwords'), requireAuth: true}} + options={{title: title(msg`App Passwords`), requireAuth: true}} /> SavedFeeds} - options={{title: title('Edit My Feeds'), requireAuth: true}} + options={{title: title(msg`Edit My Feeds`), requireAuth: true}} /> PreferencesHomeFeed} - options={{title: title('Home Feed Preferences'), requireAuth: true}} + options={{title: title(msg`Home Feed Preferences`), requireAuth: true}} /> PreferencesThreads} - options={{title: title('Threads Preferences'), requireAuth: true}} + options={{title: title(msg`Threads Preferences`), requireAuth: true}} /> PreferencesExternalEmbeds} options={{ - title: title('External Media Preferences'), + title: title(msg`External Media Preferences`), requireAuth: true, }} /> @@ -407,7 +416,7 @@ const FlatNavigator = () => { const pal = usePalette('default') const numUnread = useUnreadNotifications() - const title = (page: string) => bskyTitle(page, numUnread) + const title = (page: MessageDescriptor) => bskyTitle(i18n._(page), numUnread) return ( { HomeScreen} - options={{title: title('Home'), requireAuth: true}} + options={{title: title(msg`Home`), requireAuth: true}} /> SearchScreen} - options={{title: title('Search')}} + options={{title: title(msg`Search`)}} /> FeedsScreen} - options={{title: title('Feeds'), requireAuth: true}} + options={{title: title(msg`Feeds`), requireAuth: true}} /> NotificationsScreen} - options={{title: title('Notifications'), requireAuth: true}} + options={{title: title(msg`Notifications`), requireAuth: true}} /> {commonScreens(Flat as typeof HomeTab, numUnread)} diff --git a/src/view/com/auth/LoggedOut.tsx b/src/view/com/auth/LoggedOut.tsx index c0427ff5..603abbab 100644 --- a/src/view/com/auth/LoggedOut.tsx +++ b/src/view/com/auth/LoggedOut.tsx @@ -2,7 +2,7 @@ import React from 'react' import {View, Pressable} from 'react-native' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {useLingui} from '@lingui/react' -import {msg} from '@lingui/macro' +import {Trans, msg} from '@lingui/macro' import {useNavigation} from '@react-navigation/native' import {isIOS, isNative} from 'platform/detection' @@ -119,7 +119,7 @@ export function LoggedOut({onDismiss}: {onDismiss?: () => void}) { }} onPress={onPressSearch}> - Search{' '} + Search{' '} - Create a new account + Create a new account @@ -125,6 +125,7 @@ function Option({ }>) { const theme = useTheme() const pal = usePalette('default') + const {_} = useLingui() const circleFillStyle = React.useMemo( () => ({ backgroundColor: theme.palette.primary.background, @@ -139,7 +140,7 @@ function Option({ testID={testID} accessibilityRole="button" accessibilityLabel={label} - accessibilityHint={`Sets hosting provider to ${label}`}> + accessibilityHint={_(msg`Sets hosting provider to ${label}`)}> {isSelected ? ( diff --git a/src/view/com/auth/create/Step2.tsx b/src/view/com/auth/create/Step2.tsx index 8b143ff3..53e1e02c 100644 --- a/src/view/com/auth/create/Step2.tsx +++ b/src/view/com/auth/create/Step2.tsx @@ -60,7 +60,7 @@ export function Step2({ {uiState.isInviteCodeRequired && ( - Invite code + Invite code uiDispatch({type: 'set-invite-code', value})} accessibilityLabel={_(msg`Invite code`)} - accessibilityHint="Input invite code to proceed" + accessibilityHint={_(msg`Input invite code to proceed`)} autoCapitalize="none" autoComplete="off" autoCorrect={false} @@ -80,7 +80,7 @@ export function Step2({ {!uiState.inviteCode && uiState.isInviteCodeRequired ? ( - Don't have an invite code?{' '} + Don't have an invite code?{' '} uiDispatch({type: 'set-email', value})} accessibilityLabel={_(msg`Email`)} - accessibilityHint="Input email for Bluesky waitlist" + accessibilityHint={_(msg`Input email for Bluesky waitlist`)} accessibilityLabelledBy="email" autoCapitalize="none" autoComplete="off" @@ -130,7 +130,7 @@ export function Step2({ secureTextEntry onChange={value => uiDispatch({type: 'set-password', value})} accessibilityLabel={_(msg`Password`)} - accessibilityHint="Set password" + accessibilityHint={_(msg`Set password`)} accessibilityLabelledBy="password" autoCapitalize="none" autoComplete="off" @@ -154,7 +154,7 @@ export function Step2({ buttonStyle={[pal.border, styles.dateInputButton]} buttonLabelType="lg" accessibilityLabel={_(msg`Birthday`)} - accessibilityHint="Enter your birth date" + accessibilityHint={_(msg`Enter your birth date`)} accessibilityLabelledBy="birthDate" /> diff --git a/src/view/com/auth/create/Step3.tsx b/src/view/com/auth/create/Step3.tsx index 4c8a5851..2b2b9f7f 100644 --- a/src/view/com/auth/create/Step3.tsx +++ b/src/view/com/auth/create/Step3.tsx @@ -36,7 +36,7 @@ export function Step3({ onChange={value => uiDispatch({type: 'set-handle', value})} // TODO: Add explicit text label accessibilityLabel={_(msg`User handle`)} - accessibilityHint="Input your user handle" + accessibilityHint={_(msg`Input your user handle`)} /> Your full handle will be{' '} diff --git a/src/view/com/auth/create/StepHeader.tsx b/src/view/com/auth/create/StepHeader.tsx index 4b4eb5d2..41f91205 100644 --- a/src/view/com/auth/create/StepHeader.tsx +++ b/src/view/com/auth/create/StepHeader.tsx @@ -2,13 +2,18 @@ import React from 'react' import {StyleSheet, View} from 'react-native' import {Text} from 'view/com/util/text/Text' import {usePalette} from 'lib/hooks/usePalette' +import {Trans} from '@lingui/macro' export function StepHeader({step, title}: {step: string; title: string}) { const pal = usePalette('default') return ( - {step === '3' ? 'Last step!' : <>Step {step} of 3} + {step === '3' ? ( + Last step! + ) : ( + Step {step} of 3 + )} {title} diff --git a/src/view/com/auth/login/ChooseAccountForm.tsx b/src/view/com/auth/login/ChooseAccountForm.tsx index 73ddfc9d..32cd8315 100644 --- a/src/view/com/auth/login/ChooseAccountForm.tsx +++ b/src/view/com/auth/login/ChooseAccountForm.tsx @@ -42,7 +42,7 @@ function AccountItem({ onPress={onPress} accessibilityRole="button" accessibilityLabel={_(msg`Sign in as ${account.handle}`)} - accessibilityHint="Double tap to sign in"> + accessibilityHint={_(msg`Double tap to sign in`)}> @@ -95,19 +95,19 @@ export const ChooseAccountForm = ({ if (account.accessJwt) { if (account.did === currentAccount?.did) { setShowLoggedOut(false) - Toast.show(`Already signed in as @${account.handle}`) + Toast.show(_(msg`Already signed in as @${account.handle}`)) } else { await initSession(account) track('Sign In', {resumedSession: true}) setTimeout(() => { - Toast.show(`Signed in as @${account.handle}`) + Toast.show(_(msg`Signed in as @${account.handle}`)) }, 100) } } else { onSelectAccount(account) } }, - [currentAccount, track, initSession, onSelectAccount, setShowLoggedOut], + [currentAccount, track, initSession, onSelectAccount, setShowLoggedOut, _], ) return ( diff --git a/src/view/com/auth/login/ForgotPasswordForm.tsx b/src/view/com/auth/login/ForgotPasswordForm.tsx index 215c393d..f9bb64f9 100644 --- a/src/view/com/auth/login/ForgotPasswordForm.tsx +++ b/src/view/com/auth/login/ForgotPasswordForm.tsx @@ -67,7 +67,7 @@ export const ForgotPasswordForm = ({ const onPressNext = async () => { if (!EmailValidator.validate(email)) { - return setError('Your email appears to be invalid.') + return setError(_(msg`Your email appears to be invalid.`)) } setError('') @@ -83,7 +83,9 @@ export const ForgotPasswordForm = ({ setIsProcessing(false) if (isNetworkError(e)) { setError( - 'Unable to contact your service. Please check your Internet connection.', + _( + msg`Unable to contact your service. Please check your Internet connection.`, + ), ) } else { setError(cleanError(errMsg)) @@ -112,7 +114,9 @@ export const ForgotPasswordForm = ({ onPress={onPressSelectService} accessibilityRole="button" accessibilityLabel={_(msg`Hosting provider`)} - accessibilityHint="Sets hosting provider for password reset"> + accessibilityHint={_( + msg`Sets hosting provider for password reset`, + )}> @@ -179,7 +183,7 @@ export const ForgotPasswordForm = ({ onPress={onPressNext} accessibilityRole="button" accessibilityLabel={_(msg`Go to next`)} - accessibilityHint="Navigates to the next screen"> + accessibilityHint={_(msg`Navigates to the next screen`)}> Next diff --git a/src/view/com/auth/login/LoginForm.tsx b/src/view/com/auth/login/LoginForm.tsx index 98c5eb37..10608a54 100644 --- a/src/view/com/auth/login/LoginForm.tsx +++ b/src/view/com/auth/login/LoginForm.tsx @@ -145,7 +145,7 @@ export const LoginForm = ({ onPress={onPressSelectService} accessibilityRole="button" accessibilityLabel={_(msg`Select service`)} - accessibilityHint="Sets server for the Bluesky client"> + accessibilityHint={_(msg`Sets server for the Bluesky client`)}> {toNiceDomain(serviceUrl)} @@ -190,7 +190,9 @@ export const LoginForm = ({ } editable={!isProcessing} accessibilityLabel={_(msg`Username or email address`)} - accessibilityHint="Input the username or email address you used at signup" + accessibilityHint={_( + msg`Input the username or email address you used at signup`, + )} /> @@ -221,8 +223,8 @@ export const LoginForm = ({ accessibilityLabel={_(msg`Password`)} accessibilityHint={ identifier === '' - ? 'Input your password' - : `Input the password tied to ${identifier}` + ? _(msg`Input your password`) + : _(msg`Input the password tied to ${identifier}`) } /> + accessibilityHint={_(msg`Opens password reset form`)}> Forgot @@ -261,7 +263,7 @@ export const LoginForm = ({ onPress={onPressRetryConnect} accessibilityRole="button" accessibilityLabel={_(msg`Retry`)} - accessibilityHint="Retries login"> + accessibilityHint={_(msg`Retries login`)}> Retry @@ -281,7 +283,7 @@ export const LoginForm = ({ onPress={onPressNext} accessibilityRole="button" accessibilityLabel={_(msg`Go to next`)} - accessibilityHint="Navigates to the next screen"> + accessibilityHint={_(msg`Navigates to the next screen`)}> Next diff --git a/src/view/com/auth/login/PasswordUpdatedForm.tsx b/src/view/com/auth/login/PasswordUpdatedForm.tsx index 1e07588a..71f750b1 100644 --- a/src/view/com/auth/login/PasswordUpdatedForm.tsx +++ b/src/view/com/auth/login/PasswordUpdatedForm.tsx @@ -36,7 +36,7 @@ export const PasswordUpdatedForm = ({ onPress={onPressNext} accessibilityRole="button" accessibilityLabel={_(msg`Close alert`)} - accessibilityHint="Closes password update alert"> + accessibilityHint={_(msg`Closes password update alert`)}> Okay diff --git a/src/view/com/auth/login/SetNewPasswordForm.tsx b/src/view/com/auth/login/SetNewPasswordForm.tsx index 2bb614df..630c6afd 100644 --- a/src/view/com/auth/login/SetNewPasswordForm.tsx +++ b/src/view/com/auth/login/SetNewPasswordForm.tsx @@ -95,7 +95,7 @@ export const SetNewPasswordForm = ({ @@ -117,7 +119,7 @@ export const SetNewPasswordForm = ({ @@ -161,7 +163,7 @@ export const SetNewPasswordForm = ({ onPress={onPressNext} accessibilityRole="button" accessibilityLabel={_(msg`Go to next`)} - accessibilityHint="Navigates to the next screen"> + accessibilityHint={_(msg`Navigates to the next screen`)}> Next diff --git a/src/view/com/auth/onboarding/RecommendedFeedsItem.tsx b/src/view/com/auth/onboarding/RecommendedFeedsItem.tsx index fcc4572a..63fb0ec1 100644 --- a/src/view/com/auth/onboarding/RecommendedFeedsItem.tsx +++ b/src/view/com/auth/onboarding/RecommendedFeedsItem.tsx @@ -18,6 +18,8 @@ import { } from '#/state/queries/preferences' import {logger} from '#/logger' import {useAnalytics} from '#/lib/analytics/analytics' +import {Trans, msg} from '@lingui/macro' +import {useLingui} from '@lingui/react' export function RecommendedFeedsItem({ item, @@ -26,6 +28,7 @@ export function RecommendedFeedsItem({ }) { const {isMobile} = useWebMediaQueries() const pal = usePalette('default') + const {_} = useLingui() const {data: preferences} = usePreferencesQuery() const { mutateAsync: pinFeed, @@ -51,7 +54,7 @@ export function RecommendedFeedsItem({ await removeFeed({uri: item.uri}) resetRemoveFeed() } catch (e) { - Toast.show('There was an issue contacting your server') + Toast.show(_(msg`There was an issue contacting your server`)) logger.error('Failed to unsave feed', {error: e}) } } else { @@ -60,7 +63,7 @@ export function RecommendedFeedsItem({ resetPinFeed() track('Onboarding:CustomFeedAdded') } catch (e) { - Toast.show('There was an issue contacting your server') + Toast.show(_(msg`There was an issue contacting your server`)) logger.error('Failed to pin feed', {error: e}) } } @@ -94,7 +97,7 @@ export function RecommendedFeedsItem({ - by {sanitizeHandle(item.creator.handle, '@')} + by {sanitizeHandle(item.creator.handle, '@')} {item.description ? ( @@ -133,7 +136,7 @@ export function RecommendedFeedsItem({ color={pal.colors.textInverted} /> - Added + Added ) : ( @@ -144,7 +147,7 @@ export function RecommendedFeedsItem({ color={pal.colors.textInverted} /> - Add + Add )} diff --git a/src/view/com/auth/onboarding/RecommendedFollows.tsx b/src/view/com/auth/onboarding/RecommendedFollows.tsx index 372bbec6..93cfb738 100644 --- a/src/view/com/auth/onboarding/RecommendedFollows.tsx +++ b/src/view/com/auth/onboarding/RecommendedFollows.tsx @@ -83,7 +83,7 @@ export function RecommendedFollows({next}: Props) { - Done + Done diff --git a/src/view/com/auth/onboarding/WelcomeDesktop.tsx b/src/view/com/auth/onboarding/WelcomeDesktop.tsx index 1a30c17f..fdb31197 100644 --- a/src/view/com/auth/onboarding/WelcomeDesktop.tsx +++ b/src/view/com/auth/onboarding/WelcomeDesktop.tsx @@ -7,6 +7,7 @@ import {usePalette} from 'lib/hooks/usePalette' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {TitleColumnLayout} from 'view/com/util/layouts/TitleColumnLayout' import {Button} from 'view/com/util/forms/Button' +import {Trans} from '@lingui/macro' type Props = { next: () => void @@ -17,7 +18,7 @@ export function WelcomeDesktop({next}: Props) { const pal = usePalette('default') const horizontal = useMediaQuery({minWidth: 1300}) const title = ( - <> + Bluesky - + ) return ( - Bluesky is public. + Bluesky is public. - Your posts, likes, and blocks are public. Mutes are private. + + Your posts, likes, and blocks are public. Mutes are private. + @@ -63,10 +66,10 @@ export function WelcomeDesktop({next}: Props) { - Bluesky is open. + Bluesky is open. - Never lose access to your followers and data. + Never lose access to your followers and data. @@ -74,10 +77,13 @@ export function WelcomeDesktop({next}: Props) { - Bluesky is flexible. + Bluesky is flexible. - Choose the algorithms that power your experience with custom feeds. + + Choose the algorithms that power your experience with custom + feeds. + @@ -94,7 +100,7 @@ export function WelcomeDesktop({next}: Props) { - Next + Next diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx index a834cfc0..e24fdcf3 100644 --- a/src/view/com/composer/Composer.tsx +++ b/src/view/com/composer/Composer.tsx @@ -260,7 +260,11 @@ export const ComposePost = observer(function ComposePost({ setLangPrefs.savePostLanguageToHistory() onPost?.() onClose() - Toast.show(`Your ${replyTo ? 'reply' : 'post'} has been published`) + Toast.show( + replyTo + ? _(msg`Your reply has been published`) + : _(msg`Your post has been published`), + ) } const canPost = useMemo( @@ -269,7 +273,9 @@ export const ComposePost = observer(function ComposePost({ (!requireAltTextEnabled || !gallery.needsAltText), [graphemeLength, requireAltTextEnabled, gallery.needsAltText], ) - const selectTextInputPlaceholder = replyTo ? 'Write your reply' : `What's up?` + const selectTextInputPlaceholder = replyTo + ? _(msg`Write your reply`) + : _(msg`What's up?`) const canSelectImages = useMemo(() => gallery.size < 4, [gallery.size]) const hasMedia = gallery.size > 0 || Boolean(extLink) @@ -291,7 +297,9 @@ export const ComposePost = observer(function ComposePost({ onAccessibilityEscape={onPressCancel} accessibilityRole="button" accessibilityLabel={_(msg`Cancel`)} - accessibilityHint="Closes post composer and discards post draft"> + accessibilityHint={_( + msg`Closes post composer and discards post draft`, + )}> Cancel @@ -323,7 +331,7 @@ export const ComposePost = observer(function ComposePost({ onPress={onPressPublish} accessibilityRole="button" accessibilityLabel={ - replyTo ? 'Publish reply' : 'Publish post' + replyTo ? _(msg`Publish reply`) : _(msg`Publish post`) } accessibilityHint=""> - {replyTo ? 'Reply' : 'Post'} + {replyTo ? ( + Reply + ) : ( + Post + )} ) : ( - Post + Post )} @@ -400,7 +412,9 @@ export const ComposePost = observer(function ComposePost({ onError={setError} accessible={true} accessibilityLabel={_(msg`Write post`)} - accessibilityHint={`Compose posts up to ${MAX_GRAPHEME_LENGTH} characters in length`} + accessibilityHint={_( + msg`Compose posts up to ${MAX_GRAPHEME_LENGTH} characters in length`, + )} /> @@ -429,7 +443,9 @@ export const ComposePost = observer(function ComposePost({ onPress={() => onPressAddLinkCard(url)} accessibilityRole="button" accessibilityLabel={_(msg`Add link card`)} - accessibilityHint={`Creates a card with a thumbnail. The card links to ${url}`}> + accessibilityHint={_( + msg`Creates a card with a thumbnail. The card links to ${url}`, + )}> Add link card:{' '} {toShortUrl(url)} diff --git a/src/view/com/composer/ExternalEmbed.tsx b/src/view/com/composer/ExternalEmbed.tsx index 502e4b4d..02dd1bbd 100644 --- a/src/view/com/composer/ExternalEmbed.tsx +++ b/src/view/com/composer/ExternalEmbed.tsx @@ -68,7 +68,7 @@ export const ExternalEmbed = ({ onPress={onRemove} accessibilityRole="button" accessibilityLabel={_(msg`Remove image preview`)} - accessibilityHint={`Removes default thumbnail from ${link.uri}`} + accessibilityHint={_(msg`Removes default thumbnail from ${link.uri}`)} onAccessibilityEscape={onRemove}> diff --git a/src/view/com/composer/Prompt.tsx b/src/view/com/composer/Prompt.tsx index 9964359a..632bb263 100644 --- a/src/view/com/composer/Prompt.tsx +++ b/src/view/com/composer/Prompt.tsx @@ -22,7 +22,7 @@ export function ComposePrompt({onPressCompose}: {onPressCompose: () => void}) { onPress={() => onPressCompose()} accessibilityRole="button" accessibilityLabel={_(msg`Compose reply`)} - accessibilityHint="Opens composer"> + accessibilityHint={_(msg`Opens composer`)}> + accessibilityHint={_(msg`Opens camera on device`)}> + accessibilityHint={_(msg`Opens device photo gallery`)}> boolean @@ -187,7 +188,7 @@ const MentionList = forwardRef( }) ) : ( - No result + No result )} diff --git a/src/view/com/feeds/FeedPage.tsx b/src/view/com/feeds/FeedPage.tsx index 84d49e3b..2d0b17f3 100644 --- a/src/view/com/feeds/FeedPage.tsx +++ b/src/view/com/feeds/FeedPage.tsx @@ -197,7 +197,7 @@ export function FeedPage({ onPress={onPressCompose} icon={} accessibilityRole="button" - accessibilityLabel={_(msg`New post`)} + accessibilityLabel={_(msg({message: `New post`, context: 'action'}))} accessibilityHint="" /> )} diff --git a/src/view/com/feeds/FeedSourceCard.tsx b/src/view/com/feeds/FeedSourceCard.tsx index 338ffc3d..48716384 100644 --- a/src/view/com/feeds/FeedSourceCard.tsx +++ b/src/view/com/feeds/FeedSourceCard.tsx @@ -14,7 +14,7 @@ import * as Toast from 'view/com/util/Toast' import {sanitizeHandle} from 'lib/strings/handles' import {logger} from '#/logger' import {useModalControls} from '#/state/modals' -import {msg} from '@lingui/macro' +import {Trans, msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import { usePinFeedMutation, @@ -108,9 +108,9 @@ export function FeedSourceCardLoaded({ try { await removeFeed({uri: feed.uri}) // await item.unsave() - Toast.show('Removed from my feeds') + Toast.show(_(msg`Removed from my feeds`)) } catch (e) { - Toast.show('There was an issue contacting your server') + Toast.show(_(msg`There was an issue contacting your server`)) logger.error('Failed to unsave feed', {error: e}) } }, @@ -122,9 +122,9 @@ export function FeedSourceCardLoaded({ } else { await saveFeed({uri: feed.uri}) } - Toast.show('Added to my feeds') + Toast.show(_(msg`Added to my feeds`)) } catch (e) { - Toast.show('There was an issue contacting your server') + Toast.show(_(msg`There was an issue contacting your server`)) logger.error('Failed to save feed', {error: e}) } } @@ -164,7 +164,7 @@ export function FeedSourceCardLoaded({ testID={`feed-${feedUri}-toggleSave`} disabled={isRemovePending} accessibilityRole="button" - accessibilityLabel={'Remove from my feeds'} + accessibilityLabel={_(msg`Remove from my feeds`)} accessibilityHint="" onPress={() => { openModal({ @@ -175,9 +175,11 @@ export function FeedSourceCardLoaded({ try { await removeFeed({uri: feedUri}) // await item.unsave() - Toast.show('Removed from my feeds') + Toast.show(_(msg`Removed from my feeds`)) } catch (e) { - Toast.show('There was an issue contacting your server') + Toast.show( + _(msg`There was an issue contacting your server`), + ) logger.error('Failed to unsave feed', {error: e}) } }, @@ -223,8 +225,11 @@ export function FeedSourceCardLoaded({ {feed.displayName} - {feed.type === 'feed' ? 'Feed' : 'List'} by{' '} - {sanitizeHandle(feed.creatorHandle, '@')} + {feed.type === 'feed' ? ( + Feed by {sanitizeHandle(feed.creatorHandle, '@')} + ) : ( + List by {sanitizeHandle(feed.creatorHandle, '@')} + )} @@ -235,7 +240,7 @@ export function FeedSourceCardLoaded({ disabled={isSavePending || isPinPending || isRemovePending} accessibilityRole="button" accessibilityLabel={ - isSaved ? 'Remove from my feeds' : 'Add to my feeds' + isSaved ? _(msg`Remove from my feeds`) : _(msg`Add to my feeds`) } accessibilityHint="" onPress={onToggleSaved} @@ -269,8 +274,10 @@ export function FeedSourceCardLoaded({ {showLikes && feed.type === 'feed' ? ( - Liked by {feed.likeCount || 0}{' '} - {pluralize(feed.likeCount || 0, 'user')} + + Liked by {feed.likeCount || 0}{' '} + {pluralize(feed.likeCount || 0, 'user')} + ) : null} diff --git a/src/view/com/feeds/ProfileFeedgens.tsx b/src/view/com/feeds/ProfileFeedgens.tsx index 8665fbfa..f558eb18 100644 --- a/src/view/com/feeds/ProfileFeedgens.tsx +++ b/src/view/com/feeds/ProfileFeedgens.tsx @@ -9,13 +9,14 @@ import {Text} from '../util/text/Text' import {usePalette} from 'lib/hooks/usePalette' import {useProfileFeedgensQuery, RQKEY} from '#/state/queries/profile-feedgens' import {logger} from '#/logger' -import {Trans} from '@lingui/macro' +import {Trans, msg} from '@lingui/macro' import {cleanError} from '#/lib/strings/errors' import {useTheme} from '#/lib/ThemeContext' import {usePreferencesQuery} from '#/state/queries/preferences' import {hydrateFeedGenerator} from '#/state/queries/feed' import {FeedLoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder' import {isNative} from '#/platform/detection' +import {useLingui} from '@lingui/react' const LOADING = {_reactKey: '__loading__'} const EMPTY = {_reactKey: '__empty__'} @@ -43,6 +44,7 @@ export const ProfileFeedgens = React.forwardRef< ref, ) { const pal = usePalette('default') + const {_} = useLingui() const theme = useTheme() const [isPTRing, setIsPTRing] = React.useState(false) const opts = React.useMemo(() => ({enabled}), [enabled]) @@ -142,7 +144,9 @@ export const ProfileFeedgens = React.forwardRef< } else if (item === LOAD_MORE_ERROR_ITEM) { return ( ) @@ -162,7 +166,7 @@ export const ProfileFeedgens = React.forwardRef< } return null }, - [error, refetch, onPressRetryLoadMore, pal, preferences], + [error, refetch, onPressRetryLoadMore, pal, preferences, _], ) return ( diff --git a/src/view/com/lightbox/ImageViewing/components/ImageDefaultHeader.tsx b/src/view/com/lightbox/ImageViewing/components/ImageDefaultHeader.tsx index c806bc6a..3401adaf 100644 --- a/src/view/com/lightbox/ImageViewing/components/ImageDefaultHeader.tsx +++ b/src/view/com/lightbox/ImageViewing/components/ImageDefaultHeader.tsx @@ -24,7 +24,7 @@ const ImageDefaultHeader = ({onRequestClose}: Props) => ( hitSlop={HIT_SLOP} accessibilityRole="button" accessibilityLabel={t`Close image`} - accessibilityHint="Closes viewer for header image" + accessibilityHint={t`Closes viewer for header image`} onAccessibilityEscape={onRequestClose}> diff --git a/src/view/com/lightbox/Lightbox.tsx b/src/view/com/lightbox/Lightbox.tsx index 8a18df33..2271bb9f 100644 --- a/src/view/com/lightbox/Lightbox.tsx +++ b/src/view/com/lightbox/Lightbox.tsx @@ -15,6 +15,8 @@ import { ProfileImageLightbox, ImagesLightbox, } from '#/state/lightbox' +import {Trans, msg} from '@lingui/macro' +import {useLingui} from '@lingui/react' export function Lightbox() { const {activeLightbox} = useLightbox() @@ -53,6 +55,7 @@ export function Lightbox() { } function LightboxFooter({imageIndex}: {imageIndex: number}) { + const {_} = useLingui() const {activeLightbox} = useLightbox() const [isAltExpanded, setAltExpanded] = React.useState(false) const [permissionResponse, requestPermission] = MediaLibrary.usePermissions() @@ -60,12 +63,14 @@ function LightboxFooter({imageIndex}: {imageIndex: number}) { const saveImageToAlbumWithToasts = React.useCallback( async (uri: string) => { if (!permissionResponse || permissionResponse.granted === false) { - Toast.show('Permission to access camera roll is required.') + Toast.show(_(msg`Permission to access camera roll is required.`)) if (permissionResponse?.canAskAgain) { requestPermission() } else { Toast.show( - 'Permission to access camera roll was denied. Please enable it in your system settings.', + _( + msg`Permission to access camera roll was denied. Please enable it in your system settings.`, + ), ) } return @@ -78,7 +83,7 @@ function LightboxFooter({imageIndex}: {imageIndex: number}) { Toast.show(`Failed to save image: ${String(e)}`) } }, - [permissionResponse, requestPermission], + [permissionResponse, requestPermission, _], ) const lightbox = activeLightbox @@ -117,7 +122,7 @@ function LightboxFooter({imageIndex}: {imageIndex: number}) { onPress={() => saveImageToAlbumWithToasts(uri)}> - Save + Save diff --git a/src/view/com/lightbox/Lightbox.web.tsx b/src/view/com/lightbox/Lightbox.web.tsx index 45e1fa5a..a258d25a 100644 --- a/src/view/com/lightbox/Lightbox.web.tsx +++ b/src/view/com/lightbox/Lightbox.web.tsx @@ -110,7 +110,7 @@ function LightboxInner({ onPress={onClose} accessibilityRole="button" accessibilityLabel={_(msg`Close image viewer`)} - accessibilityHint="Exits image view" + accessibilityHint={_(msg`Exits image view`)} onAccessibilityEscape={onClose}> { setAltExpanded(!isAltExpanded) }}> diff --git a/src/view/com/lists/ListCard.tsx b/src/view/com/lists/ListCard.tsx index 774e9e91..28e98144 100644 --- a/src/view/com/lists/ListCard.tsx +++ b/src/view/com/lists/ListCard.tsx @@ -11,6 +11,7 @@ import {useSession} from '#/state/session' import {sanitizeDisplayName} from 'lib/strings/display-names' import {sanitizeHandle} from 'lib/strings/handles' import {makeProfileLink} from 'lib/routes/links' +import {Trans} from '@lingui/macro' export const ListCard = ({ testID, @@ -76,19 +77,28 @@ export const ListCard = ({ {sanitizeDisplayName(list.name)} - {list.purpose === 'app.bsky.graph.defs#curatelist' && 'User list '} + {list.purpose === 'app.bsky.graph.defs#curatelist' && + (list.creator.did === currentAccount?.did ? ( + User list by you + ) : ( + + User list by {sanitizeHandle(list.creator.handle, '@')} + + ))} {list.purpose === 'app.bsky.graph.defs#modlist' && - 'Moderation list '} - by{' '} - {list.creator.did === currentAccount?.did - ? 'you' - : sanitizeHandle(list.creator.handle, '@')} + (list.creator.did === currentAccount?.did ? ( + Moderation list by you + ) : ( + + Moderation list by {sanitizeHandle(list.creator.handle, '@')} + + ))} {!!list.viewer?.muted && ( - Subscribed + Subscribed diff --git a/src/view/com/lists/ListMembers.tsx b/src/view/com/lists/ListMembers.tsx index 932f4b51..212244cd 100644 --- a/src/view/com/lists/ListMembers.tsx +++ b/src/view/com/lists/ListMembers.tsx @@ -20,6 +20,8 @@ import {logger} from '#/logger' import {useModalControls} from '#/state/modals' import {useSession} from '#/state/session' import {cleanError} from '#/lib/strings/errors' +import {useLingui} from '@lingui/react' +import {msg} from '@lingui/macro' const LOADING_ITEM = {_reactKey: '__loading__'} const EMPTY_ITEM = {_reactKey: '__empty__'} @@ -50,6 +52,7 @@ export function ListMembers({ desktopFixedHeightOffset?: number }) { const {track} = useAnalytics() + const {_} = useLingui() const [isRefreshing, setIsRefreshing] = React.useState(false) const {isMobile} = useWebMediaQueries() const {openModal} = useModalControls() @@ -143,12 +146,12 @@ export function ListMembers({ diff --git a/src/view/com/util/forms/DropdownButton.tsx b/src/view/com/util/forms/DropdownButton.tsx index ad8f50f5..411b7748 100644 --- a/src/view/com/util/forms/DropdownButton.tsx +++ b/src/view/com/util/forms/DropdownButton.tsx @@ -75,6 +75,8 @@ export function DropdownButton({ bottomOffset = 0, accessibilityLabel, }: PropsWithChildren) { + const {_} = useLingui() + const ref1 = useRef(null) const ref2 = useRef(null) @@ -141,7 +143,9 @@ export function DropdownButton({ hitSlop={HITSLOP_10} ref={ref1} accessibilityRole="button" - accessibilityLabel={accessibilityLabel || `Opens ${numItems} options`} + accessibilityLabel={ + accessibilityLabel || _(msg`Opens ${numItems} options`) + } accessibilityHint=""> {children} @@ -247,7 +251,7 @@ const DropdownItems = ({ onPress={() => onPressItem(index)} accessibilityRole="button" accessibilityLabel={item.label} - accessibilityHint={`Option ${index + 1} of ${numItems}`}> + accessibilityHint={_(msg`Option ${index + 1} of ${numItems}`)}> {item.icon && ( { postDeleteMutation.mutateAsync({uri: postUri}).then( () => { - Toast.show('Post deleted') + Toast.show(_(msg`Post deleted`)) }, e => { logger.error('Failed to delete post', {error: e}) - Toast.show('Failed to delete post, please try again') + Toast.show(_(msg`Failed to delete post, please try again`)) }, ) - }, [postUri, postDeleteMutation]) + }, [postUri, postDeleteMutation, _]) const onToggleThreadMute = React.useCallback(() => { try { const muted = toggleThreadMute(rootUri) if (muted) { - Toast.show('You will no longer receive notifications for this thread') + Toast.show( + _(msg`You will no longer receive notifications for this thread`), + ) } else { - Toast.show('You will now receive notifications for this thread') + Toast.show(_(msg`You will now receive notifications for this thread`)) } } catch (e) { logger.error('Failed to toggle thread mute', {error: e}) } - }, [rootUri, toggleThreadMute]) + }, [rootUri, toggleThreadMute, _]) const onCopyPostText = React.useCallback(() => { Clipboard.setString(record?.text || '') - Toast.show('Copied to clipboard') - }, [record]) + Toast.show(_(msg`Copied to clipboard`)) + }, [record, _]) const onOpenTranslate = React.useCallback(() => { Linking.openURL(translatorUrl) @@ -253,7 +255,7 @@ let PostDropdownBtn = ({ diff --git a/src/view/com/util/forms/SearchInput.tsx b/src/view/com/util/forms/SearchInput.tsx index a88046d4..a78d23c9 100644 --- a/src/view/com/util/forms/SearchInput.tsx +++ b/src/view/com/util/forms/SearchInput.tsx @@ -50,7 +50,7 @@ export function SearchInput({ ( dimensionsHint || imageSizes.get(uri), ) @@ -64,7 +67,7 @@ export function AutoSizedImage({ accessible={true} // Must set for `accessibilityLabel` to work accessibilityIgnoresInvertColors accessibilityLabel={alt} - accessibilityHint="Tap to view fully" + accessibilityHint={_(msg`Tap to view fully`)} /> {children} diff --git a/src/view/com/util/images/Gallery.tsx b/src/view/com/util/images/Gallery.tsx index 094b0c56..e7110372 100644 --- a/src/view/com/util/images/Gallery.tsx +++ b/src/view/com/util/images/Gallery.tsx @@ -2,6 +2,8 @@ import {AppBskyEmbedImages} from '@atproto/api' import React, {ComponentProps, FC} from 'react' import {StyleSheet, Text, Pressable, View} from 'react-native' import {Image} from 'expo-image' +import {msg} from '@lingui/macro' +import {useLingui} from '@lingui/react' type EventFunction = (index: number) => void @@ -22,6 +24,7 @@ export const GalleryItem: FC = ({ onPressIn, onLongPress, }) => { + const {_} = useLingui() const image = images[index] return ( @@ -31,7 +34,7 @@ export const GalleryItem: FC = ({ onLongPress={onLongPress ? () => onLongPress(index) : undefined} style={styles.fullWidth} accessibilityRole="button" - accessibilityLabel={image.alt || 'Image'} + accessibilityLabel={image.alt || _(msg`Image`)} accessibilityHint=""> { @@ -57,7 +57,9 @@ export function PostHider({ } }} accessibilityRole="button" - accessibilityHint={override ? 'Hide the content' : 'Show the content'} + accessibilityHint={ + override ? _(msg`Hide the content`) : _(msg`Show the content`) + } accessibilityLabel="" style={[ styles.description, @@ -103,7 +105,7 @@ export function PostHider({ {!moderation.noOverride && ( - {override ? 'Hide' : 'Show'} + {override ? Hide : Show} )} diff --git a/src/view/com/util/post-ctrls/PostCtrls.tsx b/src/view/com/util/post-ctrls/PostCtrls.tsx index a50b5217..575f19bf 100644 --- a/src/view/com/util/post-ctrls/PostCtrls.tsx +++ b/src/view/com/util/post-ctrls/PostCtrls.tsx @@ -26,6 +26,8 @@ import { import {useComposerControls} from '#/state/shell/composer' import {Shadow} from '#/state/cache/types' import {useRequireAuth} from '#/state/session' +import {msg} from '@lingui/macro' +import {useLingui} from '@lingui/react' let PostCtrls = ({ big, @@ -43,6 +45,7 @@ let PostCtrls = ({ onPressReply: () => void }): React.ReactNode => { const theme = useTheme() + const {_} = useLingui() const {openComposer} = useComposerControls() const {closeModal} = useModalControls() const postLikeMutation = usePostLikeMutation() @@ -176,9 +179,9 @@ let PostCtrls = ({ requireAuth(() => onPressToggleLike()) }} accessibilityRole="button" - accessibilityLabel={`${post.viewer?.like ? 'Unlike' : 'Like'} (${ - post.likeCount - } ${pluralize(post.likeCount || 0, 'like')})`} + accessibilityLabel={`${ + post.viewer?.like ? _(msg`Unlike`) : _(msg`Like`) + } (${post.likeCount} ${pluralize(post.likeCount || 0, 'like')})`} accessibilityHint="" hitSlop={big ? HITSLOP_20 : HITSLOP_10}> {post.viewer?.like ? ( diff --git a/src/view/com/util/post-ctrls/RepostButton.tsx b/src/view/com/util/post-ctrls/RepostButton.tsx index 620852d8..d45bf1d8 100644 --- a/src/view/com/util/post-ctrls/RepostButton.tsx +++ b/src/view/com/util/post-ctrls/RepostButton.tsx @@ -8,6 +8,8 @@ import {pluralize} from 'lib/strings/helpers' import {HITSLOP_10, HITSLOP_20} from 'lib/constants' import {useModalControls} from '#/state/modals' import {useRequireAuth} from '#/state/session' +import {msg} from '@lingui/macro' +import {useLingui} from '@lingui/react' interface Props { isReposted: boolean @@ -25,6 +27,7 @@ let RepostButton = ({ onQuote, }: Props): React.ReactNode => { const theme = useTheme() + const {_} = useLingui() const {openModal} = useModalControls() const requireAuth = useRequireAuth() @@ -53,7 +56,9 @@ let RepostButton = ({ style={[styles.control, !big && styles.controlPad]} accessibilityRole="button" accessibilityLabel={`${ - isReposted ? 'Undo repost' : 'Repost' + isReposted + ? _(msg`Undo repost`) + : _(msg({message: 'Repost', context: 'action'})) } (${repostCount} ${pluralize(repostCount || 0, 'repost')})`} accessibilityHint="" hitSlop={big ? HITSLOP_20 : HITSLOP_10}> diff --git a/src/view/com/util/post-embeds/QuoteEmbed.tsx b/src/view/com/util/post-embeds/QuoteEmbed.tsx index fbb89af2..bb8375df 100644 --- a/src/view/com/util/post-embeds/QuoteEmbed.tsx +++ b/src/view/com/util/post-embeds/QuoteEmbed.tsx @@ -17,6 +17,7 @@ import {PostEmbeds} from '.' import {PostAlerts} from '../moderation/PostAlerts' import {makeProfileLink} from 'lib/routes/links' import {InfoCircleIcon} from 'lib/icons' +import {Trans} from '@lingui/macro' export function MaybeQuoteEmbed({ embed, @@ -52,7 +53,7 @@ export function MaybeQuoteEmbed({ - Blocked + Blocked ) @@ -61,7 +62,7 @@ export function MaybeQuoteEmbed({ - Deleted + Deleted ) diff --git a/src/view/screens/AppPasswords.tsx b/src/view/screens/AppPasswords.tsx index ab4a6a6a..dc439c36 100644 --- a/src/view/screens/AppPasswords.tsx +++ b/src/view/screens/AppPasswords.tsx @@ -62,8 +62,8 @@ export function AppPasswords({}: Props) { ]} testID="appPasswordsScreen"> diff --git a/src/view/screens/Debug.tsx b/src/view/screens/Debug.tsx index 0e046420..f26b1505 100644 --- a/src/view/screens/Debug.tsx +++ b/src/view/screens/Debug.tsx @@ -16,6 +16,8 @@ import {ToggleButton} from '../com/util/forms/ToggleButton' import {RadioGroup} from '../com/util/forms/RadioGroup' import {ErrorScreen} from '../com/util/error/ErrorScreen' import {ErrorMessage} from '../com/util/error/ErrorMessage' +import {msg} from '@lingui/macro' +import {useLingui} from '@lingui/react' const MAIN_VIEWS = ['Base', 'Controls', 'Error', 'Notifs'] @@ -48,6 +50,7 @@ function DebugInner({ }) { const [currentView, setCurrentView] = React.useState(0) const pal = usePalette('default') + const {_} = useLingui() const renderItem = (item: any) => { return ( @@ -57,7 +60,7 @@ function DebugInner({ type="default-light" onPress={onToggleColorScheme} isSelected={colorScheme === 'dark'} - label="Dark mode" + label={_(msg`Dark mode`)} /> {item.currentView === 3 ? ( @@ -77,7 +80,7 @@ function DebugInner({ return ( - + + accessibilityHint={_(msg`Opens screen to edit Saved Feeds`)}> ) diff --git a/src/view/screens/Lists.tsx b/src/view/screens/Lists.tsx index d28db7c6..23d6c8fa 100644 --- a/src/view/screens/Lists.tsx +++ b/src/view/screens/Lists.tsx @@ -73,7 +73,7 @@ export function ListsScreen({}: Props) { }}> - New + New diff --git a/src/view/screens/Log.tsx b/src/view/screens/Log.tsx index 8680b851..e727a1fb 100644 --- a/src/view/screens/Log.tsx +++ b/src/view/screens/Log.tsx @@ -50,7 +50,9 @@ export function LogScreen({}: NativeStackScreenProps< style={[styles.entry, pal.border, pal.view]} onPress={toggler(entry.id)} accessibilityLabel={_(msg`View debug entry`)} - accessibilityHint="Opens additional details for a debug entry"> + accessibilityHint={_( + msg`Opens additional details for a debug entry`, + )}> {entry.level === 'debug' ? ( ) : ( diff --git a/src/view/screens/PostThread.tsx b/src/view/screens/PostThread.tsx index 6f843441..aaadbf39 100644 --- a/src/view/screens/PostThread.tsx +++ b/src/view/screens/PostThread.tsx @@ -78,7 +78,9 @@ export function PostThreadScreen({route}: Props) { return ( - {isMobile && } + {isMobile && ( + + )} {uriError ? ( diff --git a/src/view/screens/PreferencesExternalEmbeds.tsx b/src/view/screens/PreferencesExternalEmbeds.tsx index 24e7d56d..1e8cedf7 100644 --- a/src/view/screens/PreferencesExternalEmbeds.tsx +++ b/src/view/screens/PreferencesExternalEmbeds.tsx @@ -72,7 +72,7 @@ export function PreferencesExternalEmbeds({}: Props) { - Enable media players for + Enable media players for {Object.entries(externalEmbedLabels).map(([key, label]) => ( {value === 0 - ? `Show all replies` - : `Show replies with at least ${value} ${ - value > 1 ? `likes` : `like` - }`} + ? _(msg`Show all replies`) + : _( + msg`Show replies with at least ${value} ${ + value > 1 ? `likes` : `like` + }`, + )} ) diff --git a/src/view/screens/PreferencesThreads.tsx b/src/view/screens/PreferencesThreads.tsx index 35a010b5..321c6729 100644 --- a/src/view/screens/PreferencesThreads.tsx +++ b/src/view/screens/PreferencesThreads.tsx @@ -159,7 +159,7 @@ export function PreferencesThreads({navigation}: Props) { accessibilityLabel={_(msg`Confirm`)} accessibilityHint=""> - Done + Done diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx index 4558ae33..7fc4d7a2 100644 --- a/src/view/screens/Profile.tsx +++ b/src/view/screens/Profile.tsx @@ -371,6 +371,7 @@ const FeedSection = React.forwardRef( {feed, headerHeight, isFocused, scrollElRef, ignoreFilterFor}, ref, ) { + const {_} = useLingui() const queryClient = useQueryClient() const [hasNew, setHasNew] = React.useState(false) const [isScrolledDown, setIsScrolledDown] = React.useState(false) @@ -388,8 +389,8 @@ const FeedSection = React.forwardRef( })) const renderPostsEmpty = React.useCallback(() => { - return - }, []) + return + }, [_]) return ( @@ -408,7 +409,7 @@ const FeedSection = React.forwardRef( {(isScrolledDown || hasNew) && ( )} diff --git a/src/view/screens/ProfileFeed.tsx b/src/view/screens/ProfileFeed.tsx index 211306c0..4f5f300a 100644 --- a/src/view/screens/ProfileFeed.tsx +++ b/src/view/screens/ProfileFeed.tsx @@ -214,11 +214,21 @@ export function ProfileFeedScreenInner({ } } catch (err) { Toast.show( - 'There was an an issue updating your feeds, please check your internet connection and try again.', + _( + msg`There was an an issue updating your feeds, please check your internet connection and try again.`, + ), ) logger.error('Failed up update feeds', {error: err}) } - }, [feedInfo, isSaved, saveFeed, removeFeed, resetSaveFeed, resetRemoveFeed]) + }, [ + feedInfo, + isSaved, + saveFeed, + removeFeed, + resetSaveFeed, + resetRemoveFeed, + _, + ]) const onTogglePinned = React.useCallback(async () => { try { @@ -232,10 +242,10 @@ export function ProfileFeedScreenInner({ resetPinFeed() } } catch (e) { - Toast.show('There was an issue contacting the server') + Toast.show(_(msg`There was an issue contacting the server`)) logger.error('Failed to toggle pinned feed', {error: e}) } - }, [isPinned, feedInfo, pinFeed, unpinFeed, resetPinFeed, resetUnpinFeed]) + }, [isPinned, feedInfo, pinFeed, unpinFeed, resetPinFeed, resetUnpinFeed, _]) const onPressShare = React.useCallback(() => { const url = toShareUrl(feedInfo.route.href) @@ -341,7 +351,7 @@ export function ProfileFeedScreenInner({