diff --git a/src/screens/PostThread/components/ThreadItemAnchor.tsx b/src/screens/PostThread/components/ThreadItemAnchor.tsx
index 39e84d383a..fc1f1caeb6 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 4337397f84..98520f16ea 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 31517a40f5..b009695a98 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 f6ab554b6b..f91daf54bc 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 495b3bc622..b535930104 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 ab73298ab4..1d0973add1 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 71714fddee..2965453530 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 94cc04f542..bbf9f4a200 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 97a1aa8ed2..679a506b90 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 a8e32268e1..f41f48e40c 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 14bbc47465..c2780a2a5b 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,
},
})
}