diff --git a/src/components/Post/Translated/index.tsx b/src/components/Post/Translated/index.tsx index b650153dfc..4d3162cdc6 100644 --- a/src/components/Post/Translated/index.tsx +++ b/src/components/Post/Translated/index.tsx @@ -3,7 +3,7 @@ import {Platform, View} from 'react-native' import {Trans, useLingui} from '@lingui/react/macro' import {HITSLOP_30} from '#/lib/constants' -import {useTranslateOnDevice, useTranslationKey} from '#/lib/translation' +import {useTranslate, useTranslationKey} from '#/lib/translation' import {codeToLanguageName, languageName} from '#/locale/helpers' import {LANGUAGES} from '#/locale/languages' import {useLanguagePrefs} from '#/state/preferences' @@ -21,7 +21,7 @@ export function TranslatedPost({ translationKey: string postText: string }) { - const {translationState} = useTranslateOnDevice() + const {translationState} = useTranslate() // Register this component as using this translation key with focus-based cleanup useTranslationKey(translationKey) @@ -119,7 +119,7 @@ function TranslationLanguageSelect({ const ax = useAnalytics() const {t: l} = useLingui() const langPrefs = useLanguagePrefs() - const {translate} = useTranslateOnDevice() + const {translate} = useTranslate() const items = useMemo( () => diff --git a/src/components/PostControls/PostMenu/PostMenuItems.tsx b/src/components/PostControls/PostMenu/PostMenuItems.tsx index 3985df01e2..4c94d28f85 100644 --- a/src/components/PostControls/PostMenu/PostMenuItems.tsx +++ b/src/components/PostControls/PostMenu/PostMenuItems.tsx @@ -27,7 +27,7 @@ import { } from '#/lib/routes/types' import {richTextToString} from '#/lib/strings/rich-text-helpers' import {toShareUrl} from '#/lib/strings/url-helpers' -import {useTranslateOnDevice} from '#/lib/translation' +import {useTranslate} from '#/lib/translation' import {logger} from '#/logger' import {type Shadow} from '#/state/cache/post-shadow' import {useProfileShadow} from '#/state/cache/profile-shadow' @@ -135,7 +135,7 @@ let PostMenuItems = ({ const {hidePost} = useHiddenPostsApi() const feedFeedback = useFeedFeedbackContext() const openLink = useOpenLink() - const {clearTranslation, translate, translationState} = useTranslateOnDevice() + const {clearTranslation, translate, translationState} = useTranslate() const navigation = useNavigation() const {mutedWordsDialogControl} = useGlobalDialogsControlContext() const blockPromptControl = useDialogControl() diff --git a/src/lib/translation/index.tsx b/src/lib/translation/index.tsx index acf21d588f..ec306f606e 100644 --- a/src/lib/translation/index.tsx +++ b/src/lib/translation/index.tsx @@ -78,11 +78,11 @@ async function attemptTranslation( * * Web uses index.web.ts which always opens Google Translate. */ -export function useTranslateOnDevice() { +export function useTranslate() { const context = useContext(Context) if (!context) { throw new Error( - 'useTranslateOnDevice must be used within a TranslateOnDeviceProvider', + 'useTranslate must be used within a TranslateOnDeviceProvider', ) } return context @@ -95,7 +95,7 @@ export function useTranslateOnDevice() { * loses focus. */ export function useTranslationKey(key: string) { - const {acquireTranslation} = useTranslateOnDevice() + const {acquireTranslation} = useTranslate() useFocusEffect( useCallback(() => { diff --git a/src/lib/translation/index.web.tsx b/src/lib/translation/index.web.tsx index d6d8cbb43f..5cc38805db 100644 --- a/src/lib/translation/index.web.tsx +++ b/src/lib/translation/index.web.tsx @@ -17,11 +17,11 @@ export function useTranslationKey(_key: string) {} /** * Web always opens Google Translate. */ -export function useTranslateOnDevice() { +export function useTranslate() { const context = useContext(Context) if (!context) { throw new Error( - 'useTranslateOnDevice must be used within a TranslateOnDeviceProvider', + 'useTranslate must be used within a TranslateOnDeviceProvider', ) } return context