use in app browser for translations when enabled (#2663)
This commit is contained in:
parent
4f28028569
commit
640ce5e47b
2 changed files with 17 additions and 8 deletions
|
@ -40,6 +40,7 @@ import {useLingui} from '@lingui/react'
|
|||
import {useLanguagePrefs} from '#/state/preferences'
|
||||
import {useComposerControls} from '#/state/shell/composer'
|
||||
import {useModerationOpts} from '#/state/queries/preferences'
|
||||
import {useOpenLink} from '#/state/preferences/in-app-browser'
|
||||
import {Shadow, usePostShadow, POST_TOMBSTONE} from '#/state/cache/post-shadow'
|
||||
import {ThreadPost} from '#/state/queries/post-thread'
|
||||
import {useSession} from '#/state/session'
|
||||
|
@ -701,17 +702,23 @@ function ExpandedPostDetails({
|
|||
}) {
|
||||
const pal = usePalette('default')
|
||||
const {_} = useLingui()
|
||||
const openLink = useOpenLink()
|
||||
const onTranslatePress = React.useCallback(
|
||||
() => openLink(translatorUrl),
|
||||
[openLink, translatorUrl],
|
||||
)
|
||||
return (
|
||||
<View style={[s.flexRow, s.mt2, s.mb10]}>
|
||||
<Text style={pal.textLight}>{niceDate(post.indexedAt)}</Text>
|
||||
{needsTranslation && (
|
||||
<>
|
||||
<Text style={pal.textLight}> · </Text>
|
||||
<Link href={translatorUrl} title={_(msg`Translate`)}>
|
||||
<Text style={pal.link}>
|
||||
<Trans>Translate</Trans>
|
||||
</Text>
|
||||
</Link>
|
||||
<Text
|
||||
style={pal.link}
|
||||
title={_(msg`Translate`)}
|
||||
onPress={onTranslatePress}>
|
||||
<Trans>Translate</Trans>
|
||||
</Text>
|
||||
</>
|
||||
)}
|
||||
</View>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue