From c046bed75bf1f1dfaf19b7da36bac3c9da542a69 Mon Sep 17 00:00:00 2001 From: nikk gitanes Date: Sat, 5 Jun 2021 21:38:35 +0300 Subject: [PATCH] translate details view --- web/src/components/About.jsx | 8 ++-- .../TorrentFunctions/index.jsx | 25 +++++++----- .../DialogTorrentDetailsContent/index.jsx | 18 ++++++--- web/src/locales/en/translation.json | 36 ++++++++++++----- web/src/locales/ru/translation.json | 40 +++++++++++++------ 5 files changed, 84 insertions(+), 43 deletions(-) diff --git a/web/src/components/About.jsx b/web/src/components/About.jsx index 5f72019..9327ee9 100644 --- a/web/src/components/About.jsx +++ b/web/src/components/About.jsx @@ -34,10 +34,10 @@ export default function AboutDialog() { {t('About')} -
-

TorrServer {torrServerVersion}

- https://github.com/YouROK/TorrServer -
+
+

TorrServer {torrServerVersion}

+ https://github.com/YouROK/TorrServer +

{t('ThanksToEveryone')}

diff --git a/web/src/components/DialogTorrentDetailsContent/TorrentFunctions/index.jsx b/web/src/components/DialogTorrentDetailsContent/TorrentFunctions/index.jsx index 3126544..819fd79 100644 --- a/web/src/components/DialogTorrentDetailsContent/TorrentFunctions/index.jsx +++ b/web/src/components/DialogTorrentDetailsContent/TorrentFunctions/index.jsx @@ -4,6 +4,7 @@ import { playlistTorrHost, torrentsHost, viewedHost } from 'utils/Hosts' import { CopyToClipboard } from 'react-copy-to-clipboard' import { Button } from '@material-ui/core' import ptt from 'parse-torrent-title' +import { useTranslation } from 'react-i18next' import { SmallLabel, MainSectionButtonGroup } from './style' import { SectionSubName } from '../style' @@ -19,18 +20,20 @@ const TorrentFunctions = memo( axios.post(viewedHost(), { action: 'rem', hash, file_index: -1 }).then(() => setViewedFileList()) const fullPlaylistLink = `${playlistTorrHost()}/${encodeURIComponent(name || title || 'file')}.m3u?link=${hash}&m3u` const partialPlaylistLink = `${fullPlaylistLink}&fromlast` + // eslint-disable-next-line no-unused-vars + const { t } = useTranslation() return ( <> {!isOnlyOnePlayableFile && !!viewedFileList?.length && ( <> - Download Playlist + {t('DownloadPlaylist')} - Latest file played: {latestViewedFileData?.title}. + {t('LatestFilePlayed')} {latestViewedFileData?.title}. {latestViewedFileData?.season && ( <> {' '} - Season: {latestViewedFileData?.season}. Episode: {latestViewedFileData?.episode}. + {t('Season')}: {latestViewedFileData?.season}. {t('Episode')}: {latestViewedFileData?.episode}. )} @@ -38,39 +41,39 @@ const TorrentFunctions = memo( )} - Torrent State + {t('TorrentState')} - Info + {t('Info')} {(isOnlyOnePlayableFile || !viewedFileList?.length) && ( )} diff --git a/web/src/components/DialogTorrentDetailsContent/index.jsx b/web/src/components/DialogTorrentDetailsContent/index.jsx index 200ddfc..9eec5ae 100644 --- a/web/src/components/DialogTorrentDetailsContent/index.jsx +++ b/web/src/components/DialogTorrentDetailsContent/index.jsx @@ -7,6 +7,7 @@ import axios from 'axios' import { viewedHost } from 'utils/Hosts' import { GETTING_INFO, IN_DB } from 'torrentStates' import CircularProgress from '@material-ui/core/CircularProgress' +import { useTranslation } from 'react-i18next' import { useUpdateCache, useGetSettings } from './customHooks' import DialogHeader from './DialogHeader' @@ -44,6 +45,9 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) { const [seasonAmount, setSeasonAmount] = useState(null) const [selectedSeason, setSelectedSeason] = useState() + // eslint-disable-next-line no-unused-vars + const { t } = useTranslation() + const { poster, hash, @@ -115,7 +119,7 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) { <> setIsDetailedCacheView(false) })} /> @@ -171,7 +175,7 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) { - Buffer + {t('Buffer')} {!settings?.PreloadBuffer && ( Enable "Preload Buffer" in settings to change buffer size )} @@ -190,16 +194,16 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) { size='large' onClick={() => setIsDetailedCacheView(true)} > - Detailed cache view + {t('DetailedCacheView')} - Torrent Content + {t('TorrentContent')} {seasonAmount?.length > 1 && ( <> - Select Season + {t('SelectSeason')} {seasonAmount.map(season => (