translate details view

This commit is contained in:
nikk gitanes
2021-06-05 21:38:35 +03:00
parent 2b94b26796
commit c046bed75b
5 changed files with 84 additions and 43 deletions

View File

@@ -34,10 +34,10 @@ export default function AboutDialog() {
<DialogTitle id='form-dialog-title'>{t('About')}</DialogTitle> <DialogTitle id='form-dialog-title'>{t('About')}</DialogTitle>
<DialogContent> <DialogContent>
<center> <center>
<h2>TorrServer {torrServerVersion}</h2> <h2>TorrServer {torrServerVersion}</h2>
<a href='https://github.com/YouROK/TorrServer'>https://github.com/YouROK/TorrServer</a> <a href='https://github.com/YouROK/TorrServer'>https://github.com/YouROK/TorrServer</a>
</center> </center>
<DialogContent> <DialogContent>
<center> <center>
<h2>{t('ThanksToEveryone')}</h2> <h2>{t('ThanksToEveryone')}</h2>

View File

@@ -4,6 +4,7 @@ import { playlistTorrHost, torrentsHost, viewedHost } from 'utils/Hosts'
import { CopyToClipboard } from 'react-copy-to-clipboard' import { CopyToClipboard } from 'react-copy-to-clipboard'
import { Button } from '@material-ui/core' import { Button } from '@material-ui/core'
import ptt from 'parse-torrent-title' import ptt from 'parse-torrent-title'
import { useTranslation } from 'react-i18next'
import { SmallLabel, MainSectionButtonGroup } from './style' import { SmallLabel, MainSectionButtonGroup } from './style'
import { SectionSubName } from '../style' import { SectionSubName } from '../style'
@@ -19,18 +20,20 @@ const TorrentFunctions = memo(
axios.post(viewedHost(), { action: 'rem', hash, file_index: -1 }).then(() => setViewedFileList()) axios.post(viewedHost(), { action: 'rem', hash, file_index: -1 }).then(() => setViewedFileList())
const fullPlaylistLink = `${playlistTorrHost()}/${encodeURIComponent(name || title || 'file')}.m3u?link=${hash}&m3u` const fullPlaylistLink = `${playlistTorrHost()}/${encodeURIComponent(name || title || 'file')}.m3u?link=${hash}&m3u`
const partialPlaylistLink = `${fullPlaylistLink}&fromlast` const partialPlaylistLink = `${fullPlaylistLink}&fromlast`
// eslint-disable-next-line no-unused-vars
const { t } = useTranslation()
return ( return (
<> <>
{!isOnlyOnePlayableFile && !!viewedFileList?.length && ( {!isOnlyOnePlayableFile && !!viewedFileList?.length && (
<> <>
<SmallLabel>Download Playlist</SmallLabel> <SmallLabel>{t('DownloadPlaylist')}</SmallLabel>
<SectionSubName mb={10}> <SectionSubName mb={10}>
<strong>Latest file played:</strong> {latestViewedFileData?.title}. <strong>{t('LatestFilePlayed')}</strong> {latestViewedFileData?.title}.
{latestViewedFileData?.season && ( {latestViewedFileData?.season && (
<> <>
{' '} {' '}
Season: {latestViewedFileData?.season}. Episode: {latestViewedFileData?.episode}. {t('Season')}: {latestViewedFileData?.season}. {t('Episode')}: {latestViewedFileData?.episode}.
</> </>
)} )}
</SectionSubName> </SectionSubName>
@@ -38,39 +41,39 @@ const TorrentFunctions = memo(
<MainSectionButtonGroup> <MainSectionButtonGroup>
<a style={{ textDecoration: 'none' }} href={fullPlaylistLink}> <a style={{ textDecoration: 'none' }} href={fullPlaylistLink}>
<Button style={{ width: '100%' }} variant='contained' color='primary' size='large'> <Button style={{ width: '100%' }} variant='contained' color='primary' size='large'>
full {t('Full')}
</Button> </Button>
</a> </a>
<a style={{ textDecoration: 'none' }} href={partialPlaylistLink}> <a style={{ textDecoration: 'none' }} href={partialPlaylistLink}>
<Button style={{ width: '100%' }} variant='contained' color='primary' size='large'> <Button style={{ width: '100%' }} variant='contained' color='primary' size='large'>
from latest file {t('FromLatestFile')}
</Button> </Button>
</a> </a>
</MainSectionButtonGroup> </MainSectionButtonGroup>
</> </>
)} )}
<SmallLabel mb={10}>Torrent State</SmallLabel> <SmallLabel mb={10}>{t('TorrentState')}</SmallLabel>
<MainSectionButtonGroup> <MainSectionButtonGroup>
<Button onClick={() => removeTorrentViews()} variant='contained' color='primary' size='large'> <Button onClick={() => removeTorrentViews()} variant='contained' color='primary' size='large'>
remove views {t('RemoveViews')}
</Button> </Button>
<Button onClick={() => dropTorrent()} variant='contained' color='primary' size='large'> <Button onClick={() => dropTorrent()} variant='contained' color='primary' size='large'>
reset torrent {t('DropTorrent')}
</Button> </Button>
</MainSectionButtonGroup> </MainSectionButtonGroup>
<SmallLabel mb={10}>Info</SmallLabel> <SmallLabel mb={10}>{t('Info')}</SmallLabel>
<MainSectionButtonGroup> <MainSectionButtonGroup>
{(isOnlyOnePlayableFile || !viewedFileList?.length) && ( {(isOnlyOnePlayableFile || !viewedFileList?.length) && (
<a style={{ textDecoration: 'none' }} href={fullPlaylistLink}> <a style={{ textDecoration: 'none' }} href={fullPlaylistLink}>
<Button style={{ width: '100%' }} variant='contained' color='primary' size='large'> <Button style={{ width: '100%' }} variant='contained' color='primary' size='large'>
download playlist {t('DownloadPlaylist')}
</Button> </Button>
</a> </a>
)} )}
<CopyToClipboard text={hash}> <CopyToClipboard text={hash}>
<Button variant='contained' color='primary' size='large'> <Button variant='contained' color='primary' size='large'>
copy hash {t('CopyHash')}
</Button> </Button>
</CopyToClipboard> </CopyToClipboard>
</MainSectionButtonGroup> </MainSectionButtonGroup>

View File

@@ -7,6 +7,7 @@ import axios from 'axios'
import { viewedHost } from 'utils/Hosts' import { viewedHost } from 'utils/Hosts'
import { GETTING_INFO, IN_DB } from 'torrentStates' import { GETTING_INFO, IN_DB } from 'torrentStates'
import CircularProgress from '@material-ui/core/CircularProgress' import CircularProgress from '@material-ui/core/CircularProgress'
import { useTranslation } from 'react-i18next'
import { useUpdateCache, useGetSettings } from './customHooks' import { useUpdateCache, useGetSettings } from './customHooks'
import DialogHeader from './DialogHeader' import DialogHeader from './DialogHeader'
@@ -44,6 +45,9 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
const [seasonAmount, setSeasonAmount] = useState(null) const [seasonAmount, setSeasonAmount] = useState(null)
const [selectedSeason, setSelectedSeason] = useState() const [selectedSeason, setSelectedSeason] = useState()
// eslint-disable-next-line no-unused-vars
const { t } = useTranslation()
const { const {
poster, poster,
hash, hash,
@@ -115,7 +119,7 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
<> <>
<DialogHeader <DialogHeader
onClose={closeDialog} onClose={closeDialog}
title={isDetailedCacheView ? 'Detailed Cache View' : 'Torrent Details'} title={isDetailedCacheView ? t('DetailedCacheView') : t('TorrentDetails')}
{...(isDetailedCacheView && { onBack: () => setIsDetailedCacheView(false) })} {...(isDetailedCacheView && { onBack: () => setIsDetailedCacheView(false) })}
/> />
@@ -171,7 +175,7 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
<CacheSection> <CacheSection>
<SectionHeader> <SectionHeader>
<SectionTitle mb={20}>Buffer</SectionTitle> <SectionTitle mb={20}>{t('Buffer')}</SectionTitle>
{!settings?.PreloadBuffer && ( {!settings?.PreloadBuffer && (
<SectionSubName>Enable &quot;Preload Buffer&quot; in settings to change buffer size</SectionSubName> <SectionSubName>Enable &quot;Preload Buffer&quot; in settings to change buffer size</SectionSubName>
)} )}
@@ -190,16 +194,16 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
size='large' size='large'
onClick={() => setIsDetailedCacheView(true)} onClick={() => setIsDetailedCacheView(true)}
> >
Detailed cache view {t('DetailedCacheView')}
</Button> </Button>
</CacheSection> </CacheSection>
<TorrentFilesSection> <TorrentFilesSection>
<SectionTitle mb={20}>Torrent Content</SectionTitle> <SectionTitle mb={20}>{t('TorrentContent')}</SectionTitle>
{seasonAmount?.length > 1 && ( {seasonAmount?.length > 1 && (
<> <>
<SectionSubName mb={7}>Select Season</SectionSubName> <SectionSubName mb={7}>{t('SelectSeason')}</SectionSubName>
<ButtonGroup style={{ marginBottom: '30px' }} color='primary'> <ButtonGroup style={{ marginBottom: '30px' }} color='primary'>
{seasonAmount.map(season => ( {seasonAmount.map(season => (
<Button <Button
@@ -212,7 +216,9 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
))} ))}
</ButtonGroup> </ButtonGroup>
<SectionTitle mb={20}>Season {selectedSeason}</SectionTitle> <SectionTitle mb={20}>
{t('Season')} {selectedSeason}
</SectionTitle>
</> </>
)} )}

View File

@@ -1,52 +1,68 @@
{ {
"About": "About", "About": "About",
"AddFromLink": "Add from Link", "AddFromLink": "Add from Link",
"AddRetrackers": "Add retrackers",
"Buffer": "Buffer",
"CacheSize": "Cache Size (Megabytes)", "CacheSize": "Cache Size (Megabytes)",
"Cancel": "Cancel", "Cancel": "Cancel",
"Close": "Close", "Close": "Close",
"CloseServer": "Close Server", "CloseServer": "Close Server",
"ConnectionsLimit": "Connections Limit", "ConnectionsLimit": "Connections Limit",
"CopyHash": "Copy Hash",
"Delete": "Delete", "Delete": "Delete",
"DeleteTorrent?": "Delete Torrent?", "DeleteTorrent?": "Delete Torrent?",
"DeleteTorrents?": "Delete All Torrents?", "DeleteTorrents?": "Delete All Torrents?",
"DetailedCacheView": "Detailed Cache View",
"Details": "Details", "Details": "Details",
"DhtConnectionLimit": "DHT Connection Limit",
"DHT": "DHT (Distributed Hash Table)", "DHT": "DHT (Distributed Hash Table)",
"PEX": "PEX (Peer Exchange)", "DhtConnectionLimit": "DHT Connection Limit",
"TCP": "TCP (Transmission Control Protocol)",
"Upload": "Upload (not recommended to disable)",
"UPNP": "UPnP (Universal Plug and Play)",
"UTP": "μTP (Micro Transport Protocol)",
"Donate": "Donate", "Donate": "Donate",
"DontAddRetrackers": "Don&apos;t add retrackers",
"DownloadPlaylist": "Download Playlist",
"DownloadRateLimit": "Download Rate Limit (Kilobytes)", "DownloadRateLimit": "Download Rate Limit (Kilobytes)",
"Drop": "Drop", "Drop": "Drop",
"DropTorrent": "Reset Torrent",
"EnableIPv6": "IPv6", "EnableIPv6": "IPv6",
"Episode": "Episode",
"ForceEncrypt": "Force Encrypt Headers", "ForceEncrypt": "Force Encrypt Headers",
"FromLatestFile": "From Latest File",
"Full": "Full",
"Host": "Host", "Host": "Host",
"Info": "Info",
"LatestFilePlayed": "Latest file played:",
"Name": "Name", "Name": "Name",
"OK": "OK", "OK": "OK",
"Peers": "Peers", "Peers": "Peers",
"PeersListenPort": "Peers Listen Port", "PeersListenPort": "Peers Listen Port",
"PEX": "PEX (Peer Exchange)",
"PlaylistAll": "Playlist All", "PlaylistAll": "Playlist All",
"PreloadBuffer": "Preload Buffer", "PreloadBuffer": "Preload Buffer",
"ReaderReadAHead": "Reader Read Ahead (5-100%)", "ReaderReadAHead": "Reader Read Ahead (5-100%)",
"RemoveAll": "Remove All", "RemoveAll": "Remove All",
"RemoveCacheOnDrop": "Remove Cache from Disk on Drop Torrent", "RemoveCacheOnDrop": "Remove Cache from Disk on Drop Torrent",
"RemoveCacheOnDropDesc": "If disabled, remove cache on delete torrent.", "RemoveCacheOnDropDesc": "If disabled, remove cache on delete torrent.",
"RetrackersMode": "Retrackers Mode",
"DontAddRetrackers": "Don&apos;t add retrackers",
"AddRetrackers": "Add retrackers",
"RemoveRetrackers": "Remove retrackers", "RemoveRetrackers": "Remove retrackers",
"RemoveViews": "Remove View States",
"ReplaceRetrackers": "Replace retrackers", "ReplaceRetrackers": "Replace retrackers",
"RetrackersMode": "Retrackers Mode",
"Save": "Save", "Save": "Save",
"Season": "Season",
"SelectSeason": "Select Season",
"Settings": "Settings", "Settings": "Settings",
"Size": "Size", "Size": "Size",
"SpecialThanks": "Special Thanks:", "SpecialThanks": "Special Thanks:",
"Speed": "Speed", "Speed": "Speed",
"TCP": "TCP (Transmission Control Protocol)",
"ThanksToEveryone": "Thanks to everyone who tested and helped.", "ThanksToEveryone": "Thanks to everyone who tested and helped.",
"TorrentContent": "Torrent Content",
"TorrentDetails": "Torrent Details",
"TorrentDisconnectTimeout": "Torrent Disconnect Timeout", "TorrentDisconnectTimeout": "Torrent Disconnect Timeout",
"TorrentsSavePath": "Torrents Save Path", "TorrentsSavePath": "Torrents Save Path",
"TorrentState": "Torrent State",
"Upload": "Upload (not recommended to disable)",
"UploadFile": "Upload File", "UploadFile": "Upload File",
"UploadRateLimit": "Upload Rate Limit (Kilobytes)", "UploadRateLimit": "Upload Rate Limit (Kilobytes)",
"UseDisk": "Use Disk" "UPNP": "UPnP (Universal Plug and Play)",
"UseDisk": "Use Disk",
"UTP": "μTP (Micro Transport Protocol)"
} }

View File

@@ -1,52 +1,68 @@
{ {
"About": "О сервере", "About": "О сервере",
"AddFromLink": "Добавить", "AddFromLink": "Добавить",
"AddRetrackers": "Добавлять",
"Buffer": "Буфер",
"CacheSize": "Размер кеша (Мегабайты)", "CacheSize": "Размер кеша (Мегабайты)",
"Cancel": "Отмена", "Cancel": "Отмена",
"Close": "Закрыть", "Close": "Закрыть",
"CloseServer": "Выкл. сервер", "CloseServer": "Выкл. сервер",
"ConnectionsLimit": "Торрент-соединения (рек. 20-25)", "ConnectionsLimit": "Торрент-соединения (рек. 20-25)",
"CopyHash": "Скопировать хеш",
"Delete": "Удалить", "Delete": "Удалить",
"DeleteTorrent?": "Удалить торрент?", "DeleteTorrent?": "Удалить торрент?",
"DeleteTorrents?": "Удалить все торренты?", "DeleteTorrents?": "Удалить все торренты?",
"Details": "Подробно", "DetailedCacheView": "Информация о заполнении кеша",
"DhtConnectionLimit": "Лимит подключений DHT", "Details": "Инфо",
"DHT": "DHT (Distributed Hash Table)", "DHT": "DHT (Distributed Hash Table)",
"PEX": "PEX (Peer Exchange)", "DhtConnectionLimit": "Лимит подключений DHT",
"TCP": "TCP (Transmission Control Protocol)",
"Upload": "Отдача (не рекомендуется отключать)",
"UPNP": "UPnP (Universal Plug and Play)",
"UTP": "μTP (Micro Transport Protocol)",
"Donate": "Поддержка", "Donate": "Поддержка",
"DontAddRetrackers": "Ничего не делать",
"DownloadPlaylist": "Скачать плейлист",
"DownloadRateLimit": "Ограничение скорости загрузки (Килобайты)", "DownloadRateLimit": "Ограничение скорости загрузки (Килобайты)",
"Drop": "Отключить", "Drop": "Сброс",
"DropTorrent": "Сбросить торрент",
"EnableIPv6": "IPv6", "EnableIPv6": "IPv6",
"Episode": "Серия",
"ForceEncrypt": "Принудительное шифрование заголовков", "ForceEncrypt": "Принудительное шифрование заголовков",
"FromLatestFile": "C последнего файла",
"Full": "Полный",
"Host": "Хост", "Host": "Хост",
"Info": "Инфо",
"LatestFilePlayed": "Последний воспроизведенный файл:",
"Name": "Имя", "Name": "Имя",
"OK": "OK", "OK": "OK",
"Peers": "Подкл./Пиры", "Peers": "Подкл./Пиры",
"PeersListenPort": "Порт для входящих подключений", "PeersListenPort": "Порт для входящих подключений",
"PEX": "PEX (Peer Exchange)",
"PlaylistAll": "Плейлист всех", "PlaylistAll": "Плейлист всех",
"PreloadBuffer": "Наполнять кеш перед началом воспроизведения", "PreloadBuffer": "Наполнять кеш перед началом воспроизведения",
"ReaderReadAHead": "Кеш предзагрузки (5-100%, рек. 95%)", "ReaderReadAHead": "Кеш предзагрузки (5-100%, рек. 95%)",
"RemoveAll": "Удалить все", "RemoveAll": "Удалить все",
"RemoveCacheOnDrop": "Очищать кеш на диске при отключении торрента", "RemoveCacheOnDrop": "Очищать кеш на диске при отключении торрента",
"RemoveCacheOnDropDesc": "Если отключено, кэш очищается при удалении торрента.", "RemoveCacheOnDropDesc": "Если отключено, кэш очищается при удалении торрента.",
"RetrackersMode": "Ретрекеры",
"DontAddRetrackers": "Ничего не делать",
"AddRetrackers": "Добавлять",
"RemoveRetrackers": "Удалять", "RemoveRetrackers": "Удалять",
"RemoveViews": "Удалить отметки просмотра",
"ReplaceRetrackers": "Заменять", "ReplaceRetrackers": "Заменять",
"RetrackersMode": "Ретрекеры",
"Save": "Сохранить", "Save": "Сохранить",
"Season": "Сезон",
"SelectSeason": "Выбор сезона",
"Settings": "Настройки", "Settings": "Настройки",
"Size": "Размер", "Size": "Размер",
"SpecialThanks": "Отдельное спасибо:", "SpecialThanks": "Отдельное спасибо:",
"Speed": "Скорость", "Speed": "Скорость",
"TCP": "TCP (Transmission Control Protocol)",
"ThanksToEveryone": "Спасибо всем, кто тестировал и помогал!", "ThanksToEveryone": "Спасибо всем, кто тестировал и помогал!",
"TorrentContent": "Содержимое торрента",
"TorrentDetails": "Информация о торренте",
"TorrentDisconnectTimeout": "Тайм-аут отключения торрента (секунды)", "TorrentDisconnectTimeout": "Тайм-аут отключения торрента (секунды)",
"TorrentsSavePath": "Путь хранения кеша", "TorrentsSavePath": "Путь хранения кеша",
"TorrentState": "Состояние",
"Upload": "Отдача (не рекомендуется отключать)",
"UploadFile": "Загрузить файл", "UploadFile": "Загрузить файл",
"UploadRateLimit": "Ограничение скорости отдачи (Килобайты)", "UploadRateLimit": "Ограничение скорости отдачи (Килобайты)",
"UseDisk": "Использовать кеш на диске" "UPNP": "UPnP (Universal Plug and Play)",
"UseDisk": "Использовать кеш на диске",
"UTP": "μTP (Micro Transport Protocol)"
} }