diff --git a/src/components/Instance.tsx b/src/components/Instance.tsx index 5e8c1c75..1158fe76 100644 --- a/src/components/Instance.tsx +++ b/src/components/Instance.tsx @@ -1,6 +1,5 @@ import Button from '@components/Button' import Icon from '@components/Icon' -import { useAccessibility } from '@utils/accessibility/AccessibilityManager' import { useAppsQuery } from '@utils/queryHooks/apps' import { useInstanceQuery } from '@utils/queryHooks/instance' import { getInstances } from '@utils/slices/instancesSlice' @@ -9,7 +8,7 @@ import { useTheme } from '@utils/styles/ThemeManager' import * as WebBrowser from 'expo-web-browser' import { debounce } from 'lodash' import React, { RefObject, useCallback, useMemo, useState } from 'react' -import { useTranslation } from 'react-i18next' +import { Trans, useTranslation } from 'react-i18next' import { Alert, Image, @@ -39,7 +38,6 @@ const ComponentInstance: React.FC = ({ }) => { const { t } = useTranslation('componentInstance') const { colors, mode } = useTheme() - const { screenReaderEnabled } = useAccessibility() const instances = useSelector(getInstances, () => true) const [domain, setDomain] = useState() @@ -247,7 +245,7 @@ const ComponentInstance: React.FC = ({ style={{ flexDirection: 'row', marginHorizontal: StyleConstants.Spacing.Global.PagePadding, - marginVertical: StyleConstants.Spacing.M + marginTop: StyleConstants.Spacing.M }} > = ({ { - if (screenReaderEnabled) { - analytics('view_privacy') - WebBrowser.openBrowserAsync( - 'https://tooot.app/privacy-policy' - ) - } - }} > {t('server.disclaimer.base')} - { - analytics('view_privacy') - WebBrowser.openBrowserAsync( - 'https://tooot.app/privacy-policy' - ) - }} - > - {t('server.disclaimer.privacy')} - + + + + + + { + analytics('view_privacy') + WebBrowser.openBrowserAsync( + 'https://tooot.app/privacy-policy' + ) + }} + />, + { + analytics('view_tos') + WebBrowser.openBrowserAsync( + 'https://tooot.app/terms-of-service' + ) + }} + /> + ]} + /> diff --git a/src/components/Timeline/Shared/Translate.tsx b/src/components/Timeline/Shared/Translate.tsx index c27ddfc8..f699bf8e 100644 --- a/src/components/Timeline/Shared/Translate.tsx +++ b/src/components/Timeline/Shared/Translate.tsx @@ -30,35 +30,41 @@ const TimelineTranslate = React.memo( const { t } = useTranslation('componentTimeline') const { colors } = useTheme() - let text = status.spoiler_text + const text = status.spoiler_text ? [status.spoiler_text, status.content] : [status.content] for (const i in text) { for (const emoji of status.emojis) { - text[i] = text[i].replaceAll(`:${emoji.shortcode}:`, '') + text[i] = text[i].replaceAll(`:${emoji.shortcode}:`, ' ') } + text[i] = text[i] + .replace(/(<([^>]+)>)/gi, ' ') + .replace(/@.*? /gi, ' ') + .replace(/#.*? /gi, ' ') + .replace(/http(s):\/\/.*? /gi, ' ') } const [detectedLanguage, setDetectedLanguage] = useState('') useEffect(() => { const detect = async () => { - const result = await detectLanguage(text.join(`\n`)) + const result = await detectLanguage(text.join(`\n\n`)) setDetectedLanguage(result.detected.slice(0, 2)) } detect() }, []) const settingsLanguage = useSelector(getSettingsLanguage) + const targetLanguage = settingsLanguage || Localization.locale || 'en' const [enabled, setEnabled] = useState(false) const { refetch, data, isLoading, isSuccess, isError } = useTranslateQuery({ source: detectedLanguage, - target: Localization.locale || settingsLanguage || 'en', + target: targetLanguage, text, options: { enabled } }) - console.log('detectedLanguage', detectedLanguage) + if (!detectedLanguage) { return null } @@ -118,9 +124,7 @@ const TimelineTranslate = React.memo( {__DEV__ - ? ` Source: ${detectedLanguage}; Target: ${ - Localization.locale || settingsLanguage || 'en' - }` + ? ` Source: ${detectedLanguage}; Target: ${targetLanguage}` : undefined} {isLoading ? ( diff --git a/src/i18n/de/components/instance.json b/src/i18n/de/components/instance.json index 9794585d..a3d49c32 100644 --- a/src/i18n/de/components/instance.json +++ b/src/i18n/de/components/instance.json @@ -11,8 +11,10 @@ "domains": "Domains" }, "disclaimer": { - "base": "Der Login erfolgt über den Browser, so dass Ihre Kontoinformationen für die Toot-App nicht sichtbar sind. Weitere Informationen", - "privacy": "Datenschutzbestimmungen" + "base": "Der Login erfolgt über den Browser, so dass Ihre Kontoinformationen für die Toot-App nicht sichtbar sind." + }, + "terms": { + "base": "" } }, "update": { diff --git a/src/i18n/en/components/instance.json b/src/i18n/en/components/instance.json index c9d1f43e..73412475 100644 --- a/src/i18n/en/components/instance.json +++ b/src/i18n/en/components/instance.json @@ -11,8 +11,10 @@ "domains": "Universes" }, "disclaimer": { - "base": "Logging in process uses system broswer that, your account information won't be visible to tooot app. Read more ", - "privacy": "privacy policy" + "base": "Logging in process uses system broswer that, your account information won't be visible to tooot app." + }, + "terms": { + "base": "By logging in, you agree to the <0>privacy policy and <1>terms of service." } }, "update": { diff --git a/src/i18n/it/components/instance.json b/src/i18n/it/components/instance.json index 59ba3636..59fd2652 100644 --- a/src/i18n/it/components/instance.json +++ b/src/i18n/it/components/instance.json @@ -11,8 +11,10 @@ "domains": "Universi" }, "disclaimer": { - "base": "Per accedere, verrà aperta una pagina del browser di sistema. I dati di accesso del tuo account sono protetti. Leggi di più:", - "privacy": "politica sulla privacy" + "base": "Per accedere, verrà aperta una pagina del browser di sistema. I dati di accesso del tuo account sono protetti." + }, + "terms": { + "base": "" } }, "update": { diff --git a/src/i18n/ko/components/instance.json b/src/i18n/ko/components/instance.json index b1abaf03..47d7b29a 100644 --- a/src/i18n/ko/components/instance.json +++ b/src/i18n/ko/components/instance.json @@ -11,8 +11,10 @@ "domains": "연합" }, "disclaimer": { - "base": "로그인 과정에서는 시스템 브라우저를 사용해, tooot 앱이 당신의 계정 정보를 볼 수 없어요.\n더 알아보기 ", - "privacy": "개인정보 정책" + "base": "로그인 과정에서는 시스템 브라우저를 사용해, tooot 앱이 당신의 계정 정보를 볼 수 없어요." + }, + "terms": { + "base": "" } }, "update": { diff --git a/src/i18n/pt_BR/components/instance.json b/src/i18n/pt_BR/components/instance.json index 7d619638..8f237b89 100644 --- a/src/i18n/pt_BR/components/instance.json +++ b/src/i18n/pt_BR/components/instance.json @@ -11,8 +11,10 @@ "domains": "Universo" }, "disclaimer": { - "base": "O processo de login usa o navegador do sistema e as informações da sua conta não estarão visíveis para o aplicativo Tooot. Consulte Mais informação ", - "privacy": "política de privacidade" + "base": "O processo de login usa o navegador do sistema e as informações da sua conta não estarão visíveis para o aplicativo Tooot." + }, + "terms": { + "base": "Ao fazer o login, você concorda com a <0>política de privacidade e os <1>termos de serviço." } }, "update": { diff --git a/src/i18n/vi/components/instance.json b/src/i18n/vi/components/instance.json index ee773025..a0f8748b 100644 --- a/src/i18n/vi/components/instance.json +++ b/src/i18n/vi/components/instance.json @@ -11,8 +11,10 @@ "domains": "Liên hợp" }, "disclaimer": { - "base": "tooot sẽ không thấy được thông tin tài khoản của bạn. Tìm hiểu thêm ", - "privacy": "Bảo mật" + "base": "tooot sẽ không thấy được thông tin tài khoản của bạn." + }, + "terms": { + "base": "" } }, "update": { diff --git a/src/i18n/zh-Hans/components/instance.json b/src/i18n/zh-Hans/components/instance.json index 1ac79f8f..bdda2741 100644 --- a/src/i18n/zh-Hans/components/instance.json +++ b/src/i18n/zh-Hans/components/instance.json @@ -11,8 +11,10 @@ "domains": "连结总数" }, "disclaimer": { - "base": "登录过程将使用系统浏览器,你的账号登录信息tooot应用无法读取。详见 ", - "privacy": "隐私条款" + "base": "登录过程将使用系统浏览器,你的账号登录信息tooot应用无法读取。" + }, + "terms": { + "base": "登录即表示您同意<0>隐私政策和<1>服务条款。" } }, "update": { diff --git a/src/i18n/zh-Hant/components/instance.json b/src/i18n/zh-Hant/components/instance.json index 71c2445e..0df8632d 100644 --- a/src/i18n/zh-Hant/components/instance.json +++ b/src/i18n/zh-Hant/components/instance.json @@ -11,8 +11,10 @@ "domains": "串聯宇宙" }, "disclaimer": { - "base": "將使用系統內建的瀏覽器來登入,tooot app 無法讀取您的帳號資訊;詳見 ", - "privacy": "隱私權政策" + "base": "" + }, + "terms": { + "base": "" } }, "update": {