mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
translate Add dialog and Close
This commit is contained in:
@@ -7,6 +7,7 @@ import DialogContent from '@material-ui/core/DialogContent'
|
||||
import DialogTitle from '@material-ui/core/DialogTitle'
|
||||
import { torrentsHost } from 'utils/Hosts'
|
||||
import axios from 'axios'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
export default function AddDialog({ handleClose }) {
|
||||
const [link, setLink] = useState('')
|
||||
@@ -17,23 +18,26 @@ export default function AddDialog({ handleClose }) {
|
||||
const inputTitle = ({ target: { value } }) => setTitle(value)
|
||||
const inputPoster = ({ target: { value } }) => setPoster(value)
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { t } = useTranslation()
|
||||
|
||||
const handleSave = () => {
|
||||
axios.post(torrentsHost(), { action: 'add', link, title, poster, save_to_db: true }).finally(() => handleClose())
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog open onClose={handleClose} aria-labelledby='form-dialog-title' fullWidth>
|
||||
<DialogTitle id='form-dialog-title'>Add magnet or link to torrent file</DialogTitle>
|
||||
<DialogTitle id='form-dialog-title'>{t('AddMagnetOrLink')}</DialogTitle>
|
||||
|
||||
<DialogContent>
|
||||
<TextField onChange={inputTitle} margin='dense' id='title' label='Title' type='text' fullWidth />
|
||||
<TextField onChange={inputPoster} margin='dense' id='poster' label='Poster' type='url' fullWidth />
|
||||
<TextField onChange={inputTitle} margin='dense' id='title' label={t('Title')} type='text' fullWidth />
|
||||
<TextField onChange={inputPoster} margin='dense' id='poster' label={t('Poster')} type='url' fullWidth />
|
||||
<TextField
|
||||
onChange={inputMagnet}
|
||||
autoFocus
|
||||
margin='dense'
|
||||
id='magnet'
|
||||
label='Magnet or torrent file link'
|
||||
label={t('MagnetOrTorrentFileLink')}
|
||||
type='text'
|
||||
fullWidth
|
||||
/>
|
||||
@@ -41,11 +45,11 @@ export default function AddDialog({ handleClose }) {
|
||||
|
||||
<DialogActions>
|
||||
<Button onClick={handleClose} color='primary' variant='outlined'>
|
||||
Cancel
|
||||
{t('Cancel')}
|
||||
</Button>
|
||||
|
||||
<Button variant='contained' disabled={!link} onClick={handleSave} color='primary'>
|
||||
Add
|
||||
{t('Add')}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
|
||||
@@ -2,6 +2,7 @@ import Button from '@material-ui/core/Button'
|
||||
import { AppBar, IconButton, makeStyles, Toolbar, Typography } from '@material-ui/core'
|
||||
import CloseIcon from '@material-ui/icons/Close'
|
||||
import { ArrowBack } from '@material-ui/icons'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
appBar: { position: 'relative' },
|
||||
@@ -10,6 +11,8 @@ const useStyles = makeStyles(theme => ({
|
||||
|
||||
export default function DialogHeader({ title, onClose, onBack }) {
|
||||
const classes = useStyles()
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<AppBar className={classes.appBar}>
|
||||
@@ -24,7 +27,7 @@ export default function DialogHeader({ title, onClose, onBack }) {
|
||||
|
||||
{onBack && (
|
||||
<Button autoFocus color='inherit' onClick={onClose}>
|
||||
close
|
||||
{t('Close')}
|
||||
</Button>
|
||||
)}
|
||||
</Toolbar>
|
||||
|
||||
@@ -5,12 +5,15 @@ import TorrentCard from 'components/TorrentCard'
|
||||
import axios from 'axios'
|
||||
import CircularProgress from '@material-ui/core/CircularProgress'
|
||||
import { TorrentListWrapper, CenteredGrid } from 'App/style'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
export default function TorrentList() {
|
||||
const [torrents, setTorrents] = useState([])
|
||||
const [isLoading, setIsLoading] = useState(true)
|
||||
const [isOffline, setIsOffline] = useState(true)
|
||||
const timerID = useRef(-1)
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { t } = useTranslation()
|
||||
|
||||
useEffect(() => {
|
||||
timerID.current = setInterval(() => {
|
||||
@@ -39,9 +42,9 @@ export default function TorrentList() {
|
||||
{isLoading ? (
|
||||
<CircularProgress />
|
||||
) : isOffline ? (
|
||||
<Typography>Offline</Typography>
|
||||
<Typography>{t('Offline')}</Typography>
|
||||
) : (
|
||||
!torrents.length && <Typography>No torrents added</Typography>
|
||||
!torrents.length && <Typography>{t('NoTorrentsAdded')}</Typography>
|
||||
)}
|
||||
</CenteredGrid>
|
||||
)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"About": "About",
|
||||
"Add": "Add",
|
||||
"AddFromLink": "Add from Link",
|
||||
"AddMagnetOrLink": "Add magnet or link to torrent file",
|
||||
"AddRetrackers": "Add retrackers",
|
||||
"Buffer": "Buffer",
|
||||
"CacheSize": "Cache Size (Megabytes)",
|
||||
@@ -30,12 +32,16 @@
|
||||
"Host": "Host",
|
||||
"Info": "Info",
|
||||
"LatestFilePlayed": "Latest file played:",
|
||||
"MagnetOrTorrentFileLink": "Magnet or torrent file link",
|
||||
"Name": "Name",
|
||||
"NoTorrentsAdded": "No torrents added",
|
||||
"Offline": "Offline",
|
||||
"OK": "OK",
|
||||
"Peers": "Peers",
|
||||
"PeersListenPort": "Peers Listen Port",
|
||||
"PEX": "PEX (Peer Exchange)",
|
||||
"PlaylistAll": "Playlist All",
|
||||
"Poster": "Poster",
|
||||
"PreloadBuffer": "Preload Buffer",
|
||||
"ReaderReadAHead": "Reader Read Ahead (5-100%)",
|
||||
"RemoveAll": "Remove All",
|
||||
@@ -54,6 +60,7 @@
|
||||
"Speed": "Speed",
|
||||
"TCP": "TCP (Transmission Control Protocol)",
|
||||
"ThanksToEveryone": "Thanks to everyone who tested and helped.",
|
||||
"Title": "Title",
|
||||
"TorrentContent": "Torrent Content",
|
||||
"TorrentDetails": "Torrent Details",
|
||||
"TorrentDisconnectTimeout": "Torrent Disconnect Timeout",
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"About": "О сервере",
|
||||
"Add": "Добавить",
|
||||
"AddFromLink": "Добавить",
|
||||
"AddMagnetOrLink": "Добавьте magnet или ссылку на торрент",
|
||||
"AddRetrackers": "Добавлять",
|
||||
"Buffer": "Буфер",
|
||||
"CacheSize": "Размер кеша (Мегабайты)",
|
||||
@@ -30,12 +32,16 @@
|
||||
"Host": "Хост",
|
||||
"Info": "Инфо",
|
||||
"LatestFilePlayed": "Последний воспроизведенный файл:",
|
||||
"MagnetOrTorrentFileLink": "Ссылка на файл торрента или magnet-ссылка",
|
||||
"Name": "Имя",
|
||||
"NoTorrentsAdded": "Нет торрентов",
|
||||
"Offline": "Сервер не доступен",
|
||||
"OK": "OK",
|
||||
"Peers": "Подкл./Пиры",
|
||||
"PeersListenPort": "Порт для входящих подключений",
|
||||
"PEX": "PEX (Peer Exchange)",
|
||||
"PlaylistAll": "Плейлист всех",
|
||||
"Poster": "Постер",
|
||||
"PreloadBuffer": "Наполнять кеш перед началом воспроизведения",
|
||||
"ReaderReadAHead": "Кеш предзагрузки (5-100%, рек. 95%)",
|
||||
"RemoveAll": "Удалить все",
|
||||
@@ -54,11 +60,12 @@
|
||||
"Speed": "Скорость",
|
||||
"TCP": "TCP (Transmission Control Protocol)",
|
||||
"ThanksToEveryone": "Спасибо всем, кто тестировал и помогал!",
|
||||
"Title": "Название",
|
||||
"TorrentContent": "Содержимое торрента",
|
||||
"TorrentDetails": "Информация о торренте",
|
||||
"TorrentDisconnectTimeout": "Тайм-аут отключения торрента (секунды)",
|
||||
"TorrentsSavePath": "Путь хранения кеша",
|
||||
"TorrentState": "Состояние",
|
||||
"TorrentState": "Данные торрента",
|
||||
"Upload": "Отдача (не рекомендуется отключать)",
|
||||
"UploadFile": "Загрузить файл",
|
||||
"UploadRateLimit": "Ограничение скорости отдачи (Килобайты)",
|
||||
|
||||
Reference in New Issue
Block a user