translate tables

This commit is contained in:
nikk gitanes
2021-06-06 12:13:27 +03:00
parent e961903eb6
commit 651e88e34f
4 changed files with 37 additions and 22 deletions

View File

@@ -4,6 +4,7 @@ import { humanizeSize } from 'utils/Utils'
import ptt from 'parse-torrent-title' import ptt from 'parse-torrent-title'
import { Button } from '@material-ui/core' import { Button } from '@material-ui/core'
import CopyToClipboard from 'react-copy-to-clipboard' import CopyToClipboard from 'react-copy-to-clipboard'
import { useTranslation } from 'react-i18next'
import { TableStyle, ShortTableWrapper, ShortTable } from './style' import { TableStyle, ShortTableWrapper, ShortTable } from './style'
@@ -17,6 +18,8 @@ const Table = memo(
const fileHasEpisodeText = !!playableFileList?.find(({ path }) => ptt.parse(path).episode) const fileHasEpisodeText = !!playableFileList?.find(({ path }) => ptt.parse(path).episode)
const fileHasSeasonText = !!playableFileList?.find(({ path }) => ptt.parse(path).season) const fileHasSeasonText = !!playableFileList?.find(({ path }) => ptt.parse(path).season)
const fileHasResolutionText = !!playableFileList?.find(({ path }) => ptt.parse(path).resolution) const fileHasResolutionText = !!playableFileList?.find(({ path }) => ptt.parse(path).resolution)
// eslint-disable-next-line no-unused-vars
const { t } = useTranslation()
return !playableFileList?.length ? ( return !playableFileList?.length ? (
'No playable files in this torrent' 'No playable files in this torrent'
@@ -25,13 +28,13 @@ const Table = memo(
<TableStyle> <TableStyle>
<thead> <thead>
<tr> <tr>
<th style={{ width: '0' }}>viewed</th> <th style={{ width: '0' }}>{t('Viewed')}</th>
<th>name</th> <th>{t('Name')}</th>
{fileHasSeasonText && seasonAmount?.length === 1 && <th style={{ width: '0' }}>season</th>} {fileHasSeasonText && seasonAmount?.length === 1 && <th style={{ width: '0' }}>{t('Season')}</th>}
{fileHasEpisodeText && <th style={{ width: '0' }}>episode</th>} {fileHasEpisodeText && <th style={{ width: '0' }}>{t('Episode')}</th>}
{fileHasResolutionText && <th style={{ width: '0' }}>resolution</th>} {fileHasResolutionText && <th style={{ width: '0' }}>{t('Resolution')}</th>}
<th style={{ width: '100px' }}>size</th> <th style={{ width: '100px' }}>{t('Size')}</th>
<th style={{ width: '400px' }}>actions</th> <th style={{ width: '400px' }}>{t('Actions')}</th>
</tr> </tr>
</thead> </thead>
@@ -52,18 +55,18 @@ const Table = memo(
<td data-label='size'>{humanizeSize(length)}</td> <td data-label='size'>{humanizeSize(length)}</td>
<td className='button-cell'> <td className='button-cell'>
<Button onClick={() => preloadBuffer(id)} variant='outlined' color='primary' size='small'> <Button onClick={() => preloadBuffer(id)} variant='outlined' color='primary' size='small'>
Preload {t('Preload')}
</Button> </Button>
<a style={{ textDecoration: 'none' }} href={link} target='_blank' rel='noreferrer'> <a style={{ textDecoration: 'none' }} href={link} target='_blank' rel='noreferrer'>
<Button style={{ width: '100%' }} variant='outlined' color='primary' size='small'> <Button style={{ width: '100%' }} variant='outlined' color='primary' size='small'>
Open link {t('OpenLink')}
</Button> </Button>
</a> </a>
<CopyToClipboard text={link}> <CopyToClipboard text={link}>
<Button variant='outlined' color='primary' size='small'> <Button variant='outlined' color='primary' size='small'>
Copy link {t('CopyLink')}
</Button> </Button>
</CopyToClipboard> </CopyToClipboard>
</td> </td>
@@ -87,7 +90,7 @@ const Table = memo(
<div className='short-table-data'> <div className='short-table-data'>
{isViewed && ( {isViewed && (
<div className='short-table-field'> <div className='short-table-field'>
<div className='short-table-field-name'>viewed</div> <div className='short-table-field-name'>{t('Viewed')}</div>
<div className='short-table-field-value'> <div className='short-table-field-value'>
<div className='short-table-viewed-indicator' /> <div className='short-table-viewed-indicator' />
</div> </div>
@@ -95,41 +98,41 @@ const Table = memo(
)} )}
{fileHasSeasonText && seasonAmount?.length === 1 && ( {fileHasSeasonText && seasonAmount?.length === 1 && (
<div className='short-table-field'> <div className='short-table-field'>
<div className='short-table-field-name'>season</div> <div className='short-table-field-name'>{t('Season')}</div>
<div className='short-table-field-value'>{season}</div> <div className='short-table-field-value'>{season}</div>
</div> </div>
)} )}
{fileHasEpisodeText && ( {fileHasEpisodeText && (
<div className='short-table-field'> <div className='short-table-field'>
<div className='short-table-field-name'>epoisode</div> <div className='short-table-field-name'>{t('Episode')}</div>
<div className='short-table-field-value'>{episode}</div> <div className='short-table-field-value'>{episode}</div>
</div> </div>
)} )}
{fileHasResolutionText && ( {fileHasResolutionText && (
<div className='short-table-field'> <div className='short-table-field'>
<div className='short-table-field-name'>resolution</div> <div className='short-table-field-name'>{t('Resolution')}</div>
<div className='short-table-field-value'>{resolution}</div> <div className='short-table-field-value'>{resolution}</div>
</div> </div>
)} )}
<div className='short-table-field'> <div className='short-table-field'>
<div className='short-table-field-name'>size</div> <div className='short-table-field-name'>{t('Size')}</div>
<div className='short-table-field-value'>{humanizeSize(length)}</div> <div className='short-table-field-value'>{humanizeSize(length)}</div>
</div> </div>
</div> </div>
<div className='short-table-buttons'> <div className='short-table-buttons'>
<Button onClick={() => preloadBuffer(id)} variant='outlined' color='primary' size='small'> <Button onClick={() => preloadBuffer(id)} variant='outlined' color='primary' size='small'>
Preload {t('Preload')}
</Button> </Button>
<a style={{ textDecoration: 'none' }} href={link} target='_blank' rel='noreferrer'> <a style={{ textDecoration: 'none' }} href={link} target='_blank' rel='noreferrer'>
<Button style={{ width: '100%' }} variant='outlined' color='primary' size='small'> <Button style={{ width: '100%' }} variant='outlined' color='primary' size='small'>
Open link {t('OpenLink')}
</Button> </Button>
</a> </a>
<CopyToClipboard text={link}> <CopyToClipboard text={link}>
<Button variant='outlined' color='primary' size='small'> <Button variant='outlined' color='primary' size='small'>
Copy link {t('CopyLink')}
</Button> </Button>
</CopyToClipboard> </CopyToClipboard>
</div> </div>

View File

@@ -177,7 +177,7 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
<CacheSection> <CacheSection>
<SectionHeader> <SectionHeader>
<SectionTitle mb={20}>{t('Buffer')}</SectionTitle> <SectionTitle mb={20}>{t('Buffer')}</SectionTitle>
{!settings?.PreloadBuffer && (<SectionSubName>{t('BufferNote')}</SectionSubName>)} {!settings?.PreloadBuffer && <SectionSubName>{t('BufferNote')}</SectionSubName>}
<LoadingProgress <LoadingProgress
value={Filled} value={Filled}
fullAmount={bufferSize} fullAmount={bufferSize}

View File

@@ -1,5 +1,6 @@
{ {
"About": "About", "About": "About",
"Actions": "Actions",
"Add": "Add", "Add": "Add",
"AddFromLink": "Add from Link", "AddFromLink": "Add from Link",
"AddMagnetOrLink": "Add magnet or link to torrent file", "AddMagnetOrLink": "Add magnet or link to torrent file",
@@ -12,6 +13,7 @@
"CloseServer": "Close Server", "CloseServer": "Close Server",
"ConnectionsLimit": "Connections Limit", "ConnectionsLimit": "Connections Limit",
"CopyHash": "Copy Hash", "CopyHash": "Copy Hash",
"CopyLink": "Copy link",
"Delete": "Delete", "Delete": "Delete",
"DeleteTorrent?": "Delete Torrent?", "DeleteTorrent?": "Delete Torrent?",
"DeleteTorrents?": "Delete All Torrents?", "DeleteTorrents?": "Delete All Torrents?",
@@ -38,11 +40,13 @@
"NoTorrentsAdded": "No torrents added", "NoTorrentsAdded": "No torrents added",
"Offline": "Offline", "Offline": "Offline",
"OK": "OK", "OK": "OK",
"OpenLink": "Open link",
"Peers": "Peers", "Peers": "Peers",
"PeersListenPort": "Peers Listen Port", "PeersListenPort": "Peers Listen Port",
"PEX": "PEX (Peer Exchange)", "PEX": "PEX (Peer Exchange)",
"PlaylistAll": "Playlist All", "PlaylistAll": "Playlist All",
"Poster": "Poster", "Poster": "Poster",
"Preload": "Preload",
"PreloadBuffer": "Preload Buffer", "PreloadBuffer": "Preload Buffer",
"ReaderReadAHead": "Reader Read Ahead (5-100%)", "ReaderReadAHead": "Reader Read Ahead (5-100%)",
"RemoveAll": "Remove All", "RemoveAll": "Remove All",
@@ -51,6 +55,7 @@
"RemoveRetrackers": "Remove retrackers", "RemoveRetrackers": "Remove retrackers",
"RemoveViews": "Remove View States", "RemoveViews": "Remove View States",
"ReplaceRetrackers": "Replace retrackers", "ReplaceRetrackers": "Replace retrackers",
"Resolution": "Resolution",
"RetrackersMode": "Retrackers Mode", "RetrackersMode": "Retrackers Mode",
"Save": "Save", "Save": "Save",
"Season": "Season", "Season": "Season",
@@ -72,5 +77,6 @@
"UploadRateLimit": "Upload Rate Limit (Kilobytes)", "UploadRateLimit": "Upload Rate Limit (Kilobytes)",
"UPNP": "UPnP (Universal Plug and Play)", "UPNP": "UPnP (Universal Plug and Play)",
"UseDisk": "Use Disk", "UseDisk": "Use Disk",
"UTP": "μTP (Micro Transport Protocol)" "UTP": "μTP (Micro Transport Protocol)",
"Viewed": "Viewed"
} }

View File

@@ -1,5 +1,6 @@
{ {
"About": "О сервере", "About": "О сервере",
"Actions": "Действия",
"Add": "Добавить", "Add": "Добавить",
"AddFromLink": "Добавить", "AddFromLink": "Добавить",
"AddMagnetOrLink": "Добавьте magnet или ссылку на торрент", "AddMagnetOrLink": "Добавьте magnet или ссылку на торрент",
@@ -12,6 +13,7 @@
"CloseServer": "Выкл. сервер", "CloseServer": "Выкл. сервер",
"ConnectionsLimit": "Торрент-соединения (рек. 20-25)", "ConnectionsLimit": "Торрент-соединения (рек. 20-25)",
"CopyHash": "Скопировать хеш", "CopyHash": "Скопировать хеш",
"CopyLink": "Копировать",
"Delete": "Удалить", "Delete": "Удалить",
"DeleteTorrent?": "Удалить торрент?", "DeleteTorrent?": "Удалить торрент?",
"DeleteTorrents?": "Удалить все торренты?", "DeleteTorrents?": "Удалить все торренты?",
@@ -34,15 +36,17 @@
"Info": "Инфо", "Info": "Инфо",
"LatestFilePlayed": "Последний воспроизведенный файл:", "LatestFilePlayed": "Последний воспроизведенный файл:",
"MagnetOrTorrentFileLink": "Ссылка на файл торрента или magnet-ссылка", "MagnetOrTorrentFileLink": "Ссылка на файл торрента или magnet-ссылка",
"Name": "Имя", "Name": "Название",
"NoTorrentsAdded": "Нет торрентов", "NoTorrentsAdded": "Нет торрентов",
"Offline": "Сервер не доступен", "Offline": "Сервер не доступен",
"OK": "OK", "OK": "OK",
"OpenLink": "Открыть",
"Peers": "Подкл./Пиры", "Peers": "Подкл./Пиры",
"PeersListenPort": "Порт для входящих подключений", "PeersListenPort": "Порт для входящих подключений",
"PEX": "PEX (Peer Exchange)", "PEX": "PEX (Peer Exchange)",
"PlaylistAll": "Плейлист всех", "PlaylistAll": "Плейлист всех",
"Poster": "Постер", "Poster": "Постер",
"Preload": "Предзагр.",
"PreloadBuffer": "Наполнять кеш перед началом воспроизведения", "PreloadBuffer": "Наполнять кеш перед началом воспроизведения",
"ReaderReadAHead": "Кеш предзагрузки (5-100%, рек. 95%)", "ReaderReadAHead": "Кеш предзагрузки (5-100%, рек. 95%)",
"RemoveAll": "Удалить все", "RemoveAll": "Удалить все",
@@ -51,6 +55,7 @@
"RemoveRetrackers": "Удалять", "RemoveRetrackers": "Удалять",
"RemoveViews": "Очистить просмотры", "RemoveViews": "Очистить просмотры",
"ReplaceRetrackers": "Заменять", "ReplaceRetrackers": "Заменять",
"Resolution": "Разреш.",
"RetrackersMode": "Ретрекеры", "RetrackersMode": "Ретрекеры",
"Save": "Сохранить", "Save": "Сохранить",
"Season": "Сезон", "Season": "Сезон",
@@ -72,5 +77,6 @@
"UploadRateLimit": "Ограничение скорости отдачи (Килобайты)", "UploadRateLimit": "Ограничение скорости отдачи (Килобайты)",
"UPNP": "UPnP (Universal Plug and Play)", "UPNP": "UPnP (Universal Plug and Play)",
"UseDisk": "Использовать кеш на диске", "UseDisk": "Использовать кеш на диске",
"UTP": "μTP (Micro Transport Protocol)" "UTP": "μTP (Micro Transport Protocol)",
"Viewed": "Просм."
} }