From f2f0a569cbf0e1bb7430a07450f54a7ab6e29eda Mon Sep 17 00:00:00 2001 From: surfdude29 <149612116+surfdude29@users.noreply.github.com> Date: Fri, 16 May 2025 13:30:45 +0100 Subject: [PATCH 1/6] translate `Discover` and `Following` feed names in feed.ts --- src/state/queries/feed.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/state/queries/feed.ts b/src/state/queries/feed.ts index 89023e513e2..dea7ec4469f 100644 --- a/src/state/queries/feed.ts +++ b/src/state/queries/feed.ts @@ -8,6 +8,8 @@ import { moderateFeedGenerator, RichText, } from '@atproto/api' +import {msg} from '@lingui/macro' +import {useLingui} from '@lingui/react' import { type InfiniteData, keepPreviousData, @@ -415,6 +417,7 @@ const pinnedFeedInfosQueryKeyRoot = 'pinnedFeedsInfos' export function usePinnedFeedsInfos() { const {hasSession} = useSession() const agent = useAgent() + const {_} = useLingui() const {data: preferences, isLoading: isLoadingPrefs} = usePreferencesQuery() const pinnedItems = preferences?.savedFeeds.filter(feed => feed.pinned) ?? [] @@ -428,7 +431,12 @@ export function usePinnedFeedsInfos() { ], queryFn: async () => { if (!hasSession) { - return [PWI_DISCOVER_FEED_STUB] + return [ + { + ...PWI_DISCOVER_FEED_STUB, + displayName: _(msg({message: 'Discover', context: 'feed-name'})), + }, + ] } let resolved = new Map() @@ -478,7 +486,7 @@ export function usePinnedFeedsInfos() { } else if (pinnedItem.type === 'timeline') { result.push({ type: 'feed', - displayName: 'Following', + displayName: _(msg({message: 'Following', context: 'feed-name'})), uri: pinnedItem.value, feedDescriptor: 'following', route: { From f371a10563a00a3105a2f3e76db113d99faf4c4a Mon Sep 17 00:00:00 2001 From: surfdude29 <149612116+surfdude29@users.noreply.github.com> Date: Fri, 16 May 2025 13:33:08 +0100 Subject: [PATCH 2/6] translate `Discover` feed name in DiscoverFallbackHeader.tsx --- src/view/com/posts/DiscoverFallbackHeader.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/view/com/posts/DiscoverFallbackHeader.tsx b/src/view/com/posts/DiscoverFallbackHeader.tsx index e35a33aaf77..171b41e63fd 100644 --- a/src/view/com/posts/DiscoverFallbackHeader.tsx +++ b/src/view/com/posts/DiscoverFallbackHeader.tsx @@ -1,5 +1,6 @@ import {View} from 'react-native' -import {Trans} from '@lingui/macro' +import {msg, Trans} from '@lingui/macro' +import {useLingui} from '@lingui/react' import {usePalette} from '#/lib/hooks/usePalette' import {InfoCircleIcon} from '#/lib/icons' @@ -8,6 +9,7 @@ import {Text} from '../util/text/Text' export function DiscoverFallbackHeader() { const pal = usePalette('default') + const {_} = useLingui() return ( . From 64d17fa255f3dfc92128d1fbb107bf8c31002ae8 Mon Sep 17 00:00:00 2001 From: surfdude29 <149612116+surfdude29@users.noreply.github.com> Date: Sun, 25 May 2025 17:40:56 +0100 Subject: [PATCH 3/6] =?UTF-8?q?also=20make=20`Feeds=20=E2=9C=A8`=20string?= =?UTF-8?q?=20in=20HomeHeader.tsx=20translatable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/view/com/home/HomeHeader.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/view/com/home/HomeHeader.tsx b/src/view/com/home/HomeHeader.tsx index 0ec9ac753e7..87b5142d74a 100644 --- a/src/view/com/home/HomeHeader.tsx +++ b/src/view/com/home/HomeHeader.tsx @@ -1,5 +1,7 @@ import React from 'react' import {useNavigation} from '@react-navigation/native' +import {msg} from '@lingui/macro' +import {useLingui} from '@lingui/react' import {NavigationProp} from '#/lib/routes/types' import {FeedSourceInfo} from '#/state/queries/feed' @@ -18,6 +20,7 @@ export function HomeHeader( const {feeds} = props const {hasSession} = useSession() const navigation = useNavigation() + const {_} = useLingui() const hasPinnedCustom = React.useMemo(() => { if (!hasSession) return false @@ -30,10 +33,10 @@ export function HomeHeader( const items = React.useMemo(() => { const pinnedNames = feeds.map(f => f.displayName) if (!hasPinnedCustom) { - return pinnedNames.concat('Feeds ✨') + return pinnedNames.concat(_(msg`Feeds ✨`)) } return pinnedNames - }, [hasPinnedCustom, feeds]) + }, [hasPinnedCustom, feeds, _]) const onPressFeedsLink = React.useCallback(() => { navigation.navigate('Feeds') From 81b7c93d0daabb29bff44b609aedf8f7474d0693 Mon Sep 17 00:00:00 2001 From: surfdude29 <149612116+surfdude29@users.noreply.github.com> Date: Sun, 25 May 2025 17:50:46 +0100 Subject: [PATCH 4/6] lint --- src/view/com/home/HomeHeader.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/view/com/home/HomeHeader.tsx b/src/view/com/home/HomeHeader.tsx index 87b5142d74a..eac7028588a 100644 --- a/src/view/com/home/HomeHeader.tsx +++ b/src/view/com/home/HomeHeader.tsx @@ -1,7 +1,7 @@ import React from 'react' -import {useNavigation} from '@react-navigation/native' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' +import {useNavigation} from '@react-navigation/native' import {NavigationProp} from '#/lib/routes/types' import {FeedSourceInfo} from '#/state/queries/feed' From ca91f4903e1a83a2c21c3d9c9e644436c76a2182 Mon Sep 17 00:00:00 2001 From: surfdude29 <149612116+surfdude29@users.noreply.github.com> Date: Sun, 25 May 2025 18:05:58 +0100 Subject: [PATCH 5/6] add comment for translators --- src/view/com/home/HomeHeader.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/view/com/home/HomeHeader.tsx b/src/view/com/home/HomeHeader.tsx index eac7028588a..09a7e3e144f 100644 --- a/src/view/com/home/HomeHeader.tsx +++ b/src/view/com/home/HomeHeader.tsx @@ -33,7 +33,15 @@ export function HomeHeader( const items = React.useMemo(() => { const pinnedNames = feeds.map(f => f.displayName) if (!hasPinnedCustom) { - return pinnedNames.concat(_(msg`Feeds ✨`)) + return pinnedNames.concat( + _( + msg({ + message: 'Feeds ✨', + comment: + 'Shown in tab bar on Home screen when the user has no pinned feeds', + }), + ), + ) } return pinnedNames }, [hasPinnedCustom, feeds, _]) From 0c204aa69b37283425fb79ed60753e5be3cafc21 Mon Sep 17 00:00:00 2001 From: surfdude29 <149612116+surfdude29@users.noreply.github.com> Date: Tue, 27 May 2025 11:41:41 +0100 Subject: [PATCH 6/6] correct comment --- src/view/com/home/HomeHeader.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/view/com/home/HomeHeader.tsx b/src/view/com/home/HomeHeader.tsx index 09a7e3e144f..8d3727d1df5 100644 --- a/src/view/com/home/HomeHeader.tsx +++ b/src/view/com/home/HomeHeader.tsx @@ -38,7 +38,7 @@ export function HomeHeader( msg({ message: 'Feeds ✨', comment: - 'Shown in tab bar on Home screen when the user has no pinned feeds', + 'Shown in tab bar on Home screen when logged out and when the user has no pinned feeds', }), ), )