diff --git a/src/screens/PostThread/components/ThreadItemAnchor.tsx b/src/screens/PostThread/components/ThreadItemAnchor.tsx
index 39e84d383..fc1f1caeb 100644
--- a/src/screens/PostThread/components/ThreadItemAnchor.tsx
+++ b/src/screens/PostThread/components/ThreadItemAnchor.tsx
@@ -254,6 +254,7 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({
author: post.author,
embed: post.embed,
moderation,
+ langs: record.langs,
},
onPostSuccess: onPostSuccess,
})
diff --git a/src/screens/PostThread/components/ThreadItemPost.tsx b/src/screens/PostThread/components/ThreadItemPost.tsx
index 4337397f8..98520f16e 100644
--- a/src/screens/PostThread/components/ThreadItemPost.tsx
+++ b/src/screens/PostThread/components/ThreadItemPost.tsx
@@ -234,6 +234,7 @@ const ThreadItemPostInner = memo(function ThreadItemPostInner({
author: post.author,
embed: post.embed,
moderation,
+ langs: post.record.langs,
},
onPostSuccess: onPostSuccess,
})
diff --git a/src/screens/PostThread/components/ThreadItemTreePost.tsx b/src/screens/PostThread/components/ThreadItemTreePost.tsx
index 31517a40f..b009695a9 100644
--- a/src/screens/PostThread/components/ThreadItemTreePost.tsx
+++ b/src/screens/PostThread/components/ThreadItemTreePost.tsx
@@ -298,6 +298,7 @@ const ThreadItemTreePostInner = memo(function ThreadItemTreePostInner({
author: post.author,
embed: post.embed,
moderation,
+ langs: post.record.langs,
},
onPostSuccess: onPostSuccess,
})
diff --git a/src/screens/PostThread/index.tsx b/src/screens/PostThread/index.tsx
index f6ab554b6..f91daf54b 100644
--- a/src/screens/PostThread/index.tsx
+++ b/src/screens/PostThread/index.tsx
@@ -91,6 +91,7 @@ export function PostThread({uri}: {uri: string}) {
author: post.author,
embed: post.embed,
moderation: anchor.moderation,
+ langs: post.record.langs,
},
onPostSuccess: optimisticOnPostReply,
})
diff --git a/src/screens/VideoFeed/index.tsx b/src/screens/VideoFeed/index.tsx
index 495b3bc62..b53593010 100644
--- a/src/screens/VideoFeed/index.tsx
+++ b/src/screens/VideoFeed/index.tsx
@@ -753,6 +753,7 @@ function Overlay({
text: record?.text || '',
author: post.author,
embed: post.embed,
+ langs: record?.langs,
},
})
}, [openComposer, post, record])
diff --git a/src/state/shell/composer/index.tsx b/src/state/shell/composer/index.tsx
index ab73298ab..1d0973add 100644
--- a/src/state/shell/composer/index.tsx
+++ b/src/state/shell/composer/index.tsx
@@ -20,6 +20,7 @@ export interface ComposerOptsPostRef {
uri: string
cid: string
text: string
+ langs?: string[]
author: AppBskyActorDefs.ProfileViewBasic
embed?: AppBskyFeedDefs.PostView['embed']
moderation?: ModerationDecision
diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx
index 71714fdde..296545353 100644
--- a/src/view/com/composer/Composer.tsx
+++ b/src/view/com/composer/Composer.tsx
@@ -621,7 +621,11 @@ export const ComposePost = ({
const footer = (
<>
-
+
setTimeout(cb, 1))
const cancelIdle = globalThis.cancelIdleCallback || clearTimeout
-export function SuggestedLanguage({text}: {text: string}) {
+export function SuggestedLanguage({
+ text,
+ replyToLanguage,
+}: {
+ text: string
+ replyToLanguage?: string
+}) {
const [suggestedLanguage, setSuggestedLanguage] = useState<
string | undefined
- >()
+ >(text.length === 0 ? replyToLanguage : undefined)
const langPrefs = useLanguagePrefs()
const setLangPrefs = useLanguagePrefsApi()
const t = useTheme()
const {_} = useLingui()
useEffect(() => {
+ // For replies, suggest the language of the post being replied to if no text
+ // has been typed yet
+ if (replyToLanguage && text.length === 0) {
+ setSuggestedLanguage(replyToLanguage)
+ return
+ }
+
const textTrimmed = text.trim()
// Don't run the language model on small posts, the results are likely
@@ -43,7 +56,7 @@ export function SuggestedLanguage({text}: {text: string}) {
})
return () => cancelIdle(idle)
- }, [text])
+ }, [text, replyToLanguage])
if (
suggestedLanguage &&
diff --git a/src/view/com/post-thread/PostThread.tsx b/src/view/com/post-thread/PostThread.tsx
index 94cc04f54..bbf9f4a20 100644
--- a/src/view/com/post-thread/PostThread.tsx
+++ b/src/view/com/post-thread/PostThread.tsx
@@ -420,6 +420,7 @@ export function PostThread({uri}: {uri: string}) {
author: thread.post.author,
embed: thread.post.embed,
moderation: threadModerationCache.get(thread),
+ langs: thread.record.langs,
},
onPost: onPostReply,
})
diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx
index 97a1aa8ed..679a506b9 100644
--- a/src/view/com/post-thread/PostThreadItem.tsx
+++ b/src/view/com/post-thread/PostThreadItem.tsx
@@ -299,6 +299,7 @@ let PostThreadItemLoaded = ({
author: post.author,
embed: post.embed,
moderation,
+ langs: record.langs,
},
onPost: onPostReply,
onPostSuccess: onPostSuccess,
diff --git a/src/view/com/post/Post.tsx b/src/view/com/post/Post.tsx
index a8e32268e..f41f48e40 100644
--- a/src/view/com/post/Post.tsx
+++ b/src/view/com/post/Post.tsx
@@ -131,6 +131,7 @@ function PostInner({
author: post.author,
embed: post.embed,
moderation,
+ langs: record.langs,
},
})
}, [openComposer, post, record, moderation])
diff --git a/src/view/com/posts/PostFeedItem.tsx b/src/view/com/posts/PostFeedItem.tsx
index 14bbc4746..c2780a2a5 100644
--- a/src/view/com/posts/PostFeedItem.tsx
+++ b/src/view/com/posts/PostFeedItem.tsx
@@ -193,6 +193,7 @@ let FeedItemInner = ({
author: post.author,
embed: post.embed,
moderation,
+ langs: record.langs,
},
})
}