Use non-pipe translation link (#740)

zio/stable
Ollie H 2023-05-30 16:54:47 -07:00 committed by GitHub
parent a911250ea8
commit deebe18aaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 3 deletions

View File

@ -99,7 +99,11 @@ export const PostThreadItem = observer(function PostThreadItem({
const onOpenTranslate = React.useCallback(() => { const onOpenTranslate = React.useCallback(() => {
Linking.openURL( Linking.openURL(
encodeURI(`https://translate.google.com/#auto|en|${record?.text || ''}`), encodeURI(
`https://translate.google.com/?sl=auto&tl=en&text=${
record?.text || ''
}`,
),
) )
}, [record]) }, [record])

View File

@ -170,7 +170,9 @@ const PostLoaded = observer(
const onOpenTranslate = React.useCallback(() => { const onOpenTranslate = React.useCallback(() => {
Linking.openURL( Linking.openURL(
encodeURI( encodeURI(
`https://translate.google.com/#auto|en|${record?.text || ''}`, `https://translate.google.com/?sl=auto&tl=en&text=${
record?.text || ''
}`,
), ),
) )
}, [record]) }, [record])

View File

@ -99,7 +99,11 @@ export const FeedItem = observer(function ({
const onOpenTranslate = React.useCallback(() => { const onOpenTranslate = React.useCallback(() => {
Linking.openURL( Linking.openURL(
encodeURI(`https://translate.google.com/#auto|en|${record?.text || ''}`), encodeURI(
`https://translate.google.com/?sl=auto&tl=en&text=${
record?.text || ''
}`,
),
) )
}, [record]) }, [record])