From f44e6dab72c4289313db66085ef7c92a6e3f3edf Mon Sep 17 00:00:00 2001 From: Ewan Date: Sat, 3 Jan 2026 20:17:23 +0000 Subject: [PATCH] feat: continue integration --- src/Navigation.tsx | 6 + .../PostControls/BookmarkButton.tsx | 27 +- .../PostControls/PostMenu/PostMenuItems.tsx | 46 +- .../PostControls/PostMenu/index.tsx | 4 +- src/components/PostControls/RepostButton.tsx | 64 ++- .../PostControls/RepostButton.web.tsx | 63 ++- .../PostControls/ShareMenu/ShareMenuItems.tsx | 57 ++- .../ShareMenu/ShareMenuItems.web.tsx | 71 ++- src/components/WhoCanReply.tsx | 38 +- src/components/dialogs/Embed.tsx | 24 +- src/lib/api/index.ts | 4 +- src/lib/hooks/useTerminology.ts | 62 +++ src/lib/strings/terminology.ts | 441 ++++++++++++++++++ src/screens/Bookmarks/index.tsx | 29 +- src/screens/Post/PostLikedBy.tsx | 6 +- src/screens/Post/PostQuotes.tsx | 6 +- src/screens/Post/PostRepostedBy.tsx | 12 +- .../PostThread/components/ThreadError.tsx | 9 +- .../components/ThreadItemAnchor.tsx | 29 +- .../PostThread/components/ThreadItemPost.tsx | 7 +- .../components/ThreadItemPostTombstone.tsx | 9 +- src/screens/Profile/Header/Metrics.tsx | 9 +- src/screens/Profile/ProfileFeed/index.tsx | 5 +- src/screens/Profile/ProfileSearch.tsx | 9 +- src/screens/Profile/Sections/Feed.tsx | 5 +- src/screens/Settings/DeerSettings.tsx | 30 +- .../Settings/FollowingFeedPreferences.tsx | 27 +- .../LikesOnRepostsNotificationSettings.tsx | 21 +- .../RepostNotificationSettings.tsx | 19 +- .../RepostsOnRepostsNotificationSettings.tsx | 22 +- src/state/queries/pinned-post.ts | 9 +- src/view/com/composer/Composer.tsx | 31 +- .../select-language/PostLanguageSelect.tsx | 13 +- .../PostLanguageSelectDialog.tsx | 7 +- src/view/com/post-thread/PostRepostedBy.tsx | 17 +- src/view/com/posts/PostFeedReason.tsx | 11 +- src/view/shell/desktop/LeftNav.tsx | 15 +- 37 files changed, 1070 insertions(+), 194 deletions(-) create mode 100644 src/lib/hooks/useTerminology.ts create mode 100644 src/lib/strings/terminology.ts diff --git a/src/Navigation.tsx b/src/Navigation.tsx index 6ff19746a..bc713cfa6 100644 --- a/src/Navigation.tsx +++ b/src/Navigation.tsx @@ -158,6 +158,12 @@ const Tab = createBottomTabNavigator() /** * These "common screens" are reused across stacks. + * + * Note: Navigation titles use i18n._() which evaluates at setup time, not render time. + * This means they cannot dynamically respond to terminology preference changes. + * All in-app content (buttons, dialogs, messages) uses the terminology system, + * but these navigation bar titles remain static. This is a low-impact limitation + * as navigation titles are rarely noticed by users. */ function commonScreens(Stack: typeof Flat, unreadCountLabel?: string) { const title = (page: MessageDescriptor) => diff --git a/src/components/PostControls/BookmarkButton.tsx b/src/components/PostControls/BookmarkButton.tsx index d95ec7006..73af4c8a3 100644 --- a/src/components/PostControls/BookmarkButton.tsx +++ b/src/components/PostControls/BookmarkButton.tsx @@ -6,6 +6,8 @@ import {useLingui} from '@lingui/react' import type React from 'react' import {useCleanError} from '#/lib/hooks/useCleanError' +import {getTerminology} from '#/lib/strings/terminology' +import {useTerminologyPreference} from '#/state/preferences' import {logger} from '#/logger' import {type Shadow} from '#/state/cache/post-shadow' import {useBookmarkMutation} from '#/state/queries/bookmarks/useBookmarkMutation' @@ -29,6 +31,7 @@ export const BookmarkButton = memo(function BookmarkButton({ }): React.ReactNode { const t = useTheme() const {_} = useLingui() + const terminologyPreference = useTerminologyPreference() const {mutateAsync: bookmark} = useBookmarkMutation() const cleanError = useCleanError() const requireAuth = useRequireAuth() @@ -56,7 +59,11 @@ export const BookmarkButton = memo(function BookmarkButton({ - Skeet saved + {_(getTerminology(terminologyPreference, { + skeet: msg`Skeet saved`, + post: msg`Post saved`, + spell: msg`Spell saved`, + }))} {!disableUndo && ( - Removed from saved skeets + {_(getTerminology(terminologyPreference, { + skeet: msg`Removed from saved skeets`, + post: msg`Removed from saved posts`, + spell: msg`Removed from saved spells`, + }))} {!disableUndo && ( diff --git a/src/components/PostControls/PostMenu/PostMenuItems.tsx b/src/components/PostControls/PostMenu/PostMenuItems.tsx index 9622eaf0e..bd9c64acf 100644 --- a/src/components/PostControls/PostMenu/PostMenuItems.tsx +++ b/src/components/PostControls/PostMenu/PostMenuItems.tsx @@ -47,6 +47,7 @@ import {useProfileShadow} from '#/state/cache/profile-shadow' import {useFeedFeedbackContext} from '#/state/feed-feedback' import {useLanguagePrefs} from '#/state/preferences' import {useHiddenPosts, useHiddenPostsApi} from '#/state/preferences' +import {useTerminology} from '#/lib/hooks/useTerminology' import {usePinnedPostMutation} from '#/state/queries/pinned-post' import { usePostDeleteMutation, @@ -188,6 +189,7 @@ let PostMenuItems = ({ postUri: post.uri, rootPostUri: rootUri, }) + const terminology = useTerminology() const href = useMemo(() => { const urip = new AtUri(postUri) @@ -197,7 +199,7 @@ let PostMenuItems = ({ const onDeletePost = () => { deletePostMutate({uri: postUri}).then( () => { - Toast.show(_(msg({message: 'Skeet deleted', context: 'toast'}))) + Toast.show(_(msg({message: `${_(terminology.post)} deleted`, context: 'toast'}))) const route = getCurrentRoute(navigation.getState()) if (route.name === 'PostThread') { @@ -217,7 +219,7 @@ let PostMenuItems = ({ }, e => { logger.error('Failed to delete post', {message: e}) - Toast.show(_(msg`Failed to delete skeet, please try again`), 'xmark') + Toast.show(_(msg`Failed to delete ${_(terminology.post)}, please try again`), 'xmark') }, ) } @@ -475,8 +477,8 @@ let PostMenuItems = ({ }) Toast.show( isDetach - ? _(msg`Quote skeet was successfully detached`) - : _(msg`Quote skeet was re-attached`), + ? _(msg`Quote ${_(terminology.post)} was successfully detached`) + : _(msg`Quote ${_(terminology.post)} was re-attached`), ) } catch (e: any) { Toast.show( @@ -667,9 +669,9 @@ let PostMenuItems = ({ <> - {_(msg`Copy skeet text`)} + {_(msg`Copy ${_(terminology.post)} text`)} ) : ( - {_(msg`Sign in to view skeet`)} + {_(msg`Sign in to view ${_(terminology.post)}`)} )} @@ -847,13 +849,13 @@ let PostMenuItems = ({ label={ isReply ? _(msg`Hide reply for me`) - : _(msg`Hide skeet for me`) + : _(msg`Hide ${_(terminology.post)} for me`) } onPress={() => hidePromptControl.open()}> {isReply ? _(msg`Hide reply for me`) - : _(msg`Hide skeet for me`)} + : _(msg`Hide ${_(terminology.post)} for me`)} @@ -955,9 +957,9 @@ let PostMenuItems = ({ reportDialogControl.open()}> - {_(msg`Report skeet`)} + {_(msg`Report ${_(terminology.post)}`)} @@ -986,9 +988,9 @@ let PostMenuItems = ({ deletePromptControl.open()}> - {_(msg`Delete skeet`)} + {_(msg`Delete ${_(terminology.post)}`)} @@ -1000,9 +1002,9 @@ let PostMenuItems = ({