Fix privacy translations
This commit is contained in:
parent
a995ffc24d
commit
52699840b6
3 changed files with 5 additions and 82 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { useEffect, useRef } from 'react';
|
||||
import { useState, useEffect, useRef } from 'react';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
|
|
@ -22,11 +22,14 @@ const Privacy = () => {
|
|||
const { push } = useHistory();
|
||||
const { t, i18n } = useTranslation(['common', 'privacy']);
|
||||
const contentRef = useRef();
|
||||
const [content, setContent] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
document.title = `${t('privacy:name')} - Crab Fit`;
|
||||
}, [t]);
|
||||
|
||||
useEffect(() => setContent(contentRef.current?.innerText || ''), [contentRef.current]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<StyledMain>
|
||||
|
|
@ -39,7 +42,7 @@ const Privacy = () => {
|
|||
{!i18n.language.startsWith('en') && (
|
||||
<p>
|
||||
<a
|
||||
href={`https://translate.google.com/?sl=en&tl=${i18n.language.substring(0, 2)}&text=${encodeURIComponent(`${translationDisclaimer}\n\n${contentRef.current?.innerText}`)}&op=translate`}
|
||||
href={`https://translate.google.com/?sl=en&tl=${i18n.language.substring(0, 2)}&text=${encodeURIComponent(`${translationDisclaimer}\n\n${content}`)}&op=translate`}
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>{t('privacy:translate')}</a>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue