From b6cdbacaca4c4173d50ddafb1a9dc8ddaa74bab7 Mon Sep 17 00:00:00 2001 From: nikk gitanes Date: Mon, 7 Jun 2021 19:03:36 +0300 Subject: [PATCH 1/4] translate donate snackbar and torrent states --- .../DialogTorrentDetailsContent/widgets.jsx | 15 ++++++++++++++- web/src/components/Donate/index.jsx | 6 ++++-- web/src/locales/en/translation.json | 8 ++++++++ web/src/locales/ru/translation.json | 10 +++++++++- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/web/src/components/DialogTorrentDetailsContent/widgets.jsx b/web/src/components/DialogTorrentDetailsContent/widgets.jsx index f9571ff..c3d65e3 100644 --- a/web/src/components/DialogTorrentDetailsContent/widgets.jsx +++ b/web/src/components/DialogTorrentDetailsContent/widgets.jsx @@ -71,7 +71,20 @@ export const PiecesLengthWidget = ({ data }) => { export const StatusWidget = ({ data }) => { const { t } = useTranslation() - return + let i18nd = data + if (data.toLowerCase() === 'torrent added') + i18nd = t('TorrentAdded') + else if (data.toLowerCase() === 'torrent getting info') + i18nd = t('TorrentGettingInfo') + else if (data.toLowerCase() === 'torrent preload') + i18nd = t('TorrentPreload') + else if (data.toLowerCase() === 'torrent working') + i18nd = t('TorrentWorking') + else if (data.toLowerCase() === 'torrent closed') + i18nd = t('TorrentClosed') + else if (data.toLowerCase() === 'torrent in db') + i18nd = t('TorrentInDb') + return } export const SizeWidget = ({ data }) => { diff --git a/web/src/components/Donate/index.jsx b/web/src/components/Donate/index.jsx index eff69da..c689e4a 100644 --- a/web/src/components/Donate/index.jsx +++ b/web/src/components/Donate/index.jsx @@ -4,10 +4,12 @@ import Snackbar from '@material-ui/core/Snackbar' import IconButton from '@material-ui/core/IconButton' import CreditCardIcon from '@material-ui/icons/CreditCard' import CloseIcon from '@material-ui/icons/Close' +import { useTranslation } from 'react-i18next' import DonateDialog from './DonateDialog' export default function DonateSnackbar() { + const { t } = useTranslation() const [open, setOpen] = useState(false) const [snackbarOpen, setSnackbarOpen] = useState(true) @@ -27,7 +29,7 @@ export default function DonateSnackbar() { }} open={snackbarOpen} onClose={disableSnackbar} - message='Donate?' + message={t('Donate?')} action={ <> diff --git a/web/src/locales/en/translation.json b/web/src/locales/en/translation.json index 18eb1ce..6965d12 100644 --- a/web/src/locales/en/translation.json +++ b/web/src/locales/en/translation.json @@ -24,6 +24,7 @@ "DHT": "DHT (Distributed Hash Table)", "DhtConnectionLimit": "DHT Connection Limit", "Donate": "Donate", + "Donate?": "Want to donate?", "DontAddRetrackers": "Don`t add retrackers", "DownloadPlaylist": "Download Playlist", "DownloadRateLimit": "Download Rate Limit (Kilobytes)", @@ -69,16 +70,23 @@ "Size": "Size", "SpecialThanks": "Special Thanks:", "Speed": "Speed", + "Support": "Support", "TCP": "TCP (Transmission Control Protocol)", "ThanksToEveryone": "Thanks to everyone who tested and helped.", "Title": "Title", + "TorrentAdded": "Added", + "TorrentClosed": "Сlosed", "TorrentContent": "Torrent Content", "TorrentDetails": "Torrent Details", "TorrentDisconnectTimeout": "Torrent Disconnect Timeout", + "TorrentGettingInfo": "Getting Info", + "TorrentInDb": "In DB", + "TorrentPreload": "Preload", "TorrentSize": "Torrent size", "TorrentsSavePath": "Torrents Save Path", "TorrentState": "Torrent State", "TorrentStatus": "Torrent Status", + "TorrentWorking": "Active", "TurnOff": "Turn Off", "Upload": "Upload (not recommended to disable)", "UploadFile": "Upload File", diff --git a/web/src/locales/ru/translation.json b/web/src/locales/ru/translation.json index f351917..181c73c 100644 --- a/web/src/locales/ru/translation.json +++ b/web/src/locales/ru/translation.json @@ -24,6 +24,7 @@ "DHT": "DHT (Distributed Hash Table)", "DhtConnectionLimit": "Лимит подключений DHT", "Donate": "Поддержка", + "Donate?": "Хотите поддержать проект?", "DontAddRetrackers": "Ничего не делать", "DownloadPlaylist": "Скачать плейлист", "DownloadRateLimit": "Ограничение скорости загрузки (Килобайты)", @@ -69,16 +70,23 @@ "Size": "Размер", "SpecialThanks": "Отдельное спасибо:", "Speed": "Скорость", + "Support": "Поддержать", "TCP": "TCP (Transmission Control Protocol)", "ThanksToEveryone": "Спасибо всем, кто тестировал и помогал!", "Title": "Название", + "TorrentAdded": "Добавлен", + "TorrentClosed": "Закрыт", "TorrentContent": "Содержимое торрента", "TorrentDetails": "Информация о торренте", "TorrentDisconnectTimeout": "Тайм-аут отключения торрента (секунды)", + "TorrentGettingInfo": "Получение инфо", + "TorrentInDb": "Торрент в БД", + "TorrentPreload": "Предзагрузка", "TorrentSize": "Размер торрента", "TorrentsSavePath": "Путь хранения кеша", "TorrentState": "Данные торрента", - "TorrentStatus": "Состояние", + "TorrentStatus": "Состояние торрента", + "TorrentWorking": "Активен", "TurnOff": "Выключить", "Upload": "Отдача (не рекомендуется отключать)", "UploadFile": "Загрузить файл", From dbe8bbe22fd486b0151658218381d2cdfe7c552a Mon Sep 17 00:00:00 2001 From: YouROK <8yourok8@mail.ru> Date: Tue, 8 Jun 2021 19:37:53 +0300 Subject: [PATCH 2/4] update web --- server/web/pages/template/pages/index.html | 10 +++++----- web/dest/index.html | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/server/web/pages/template/pages/index.html b/server/web/pages/template/pages/index.html index b23070c..ea54034 100644 --- a/server/web/pages/template/pages/index.html +++ b/server/web/pages/template/pages/index.html @@ -1,10 +1,10 @@ -TorrServer
\ No newline at end of file + \ No newline at end of file diff --git a/web/dest/index.html b/web/dest/index.html index b23070c..ea54034 100644 --- a/web/dest/index.html +++ b/web/dest/index.html @@ -1,10 +1,10 @@ -TorrServer
\ No newline at end of file + \ No newline at end of file From 2974679789b60127b12daf15954788fc1c99599e Mon Sep 17 00:00:00 2001 From: YouROK <8yourok8@mail.ru> Date: Tue, 8 Jun 2021 19:38:26 +0300 Subject: [PATCH 3/4] add docker compile --- docker-all.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 docker-all.sh diff --git a/docker-all.sh b/docker-all.sh new file mode 100755 index 0000000..b2817c1 --- /dev/null +++ b/docker-all.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +ROOT=${PWD} + +#### Build web +echo "Build web" +cd "${ROOT}/web" || exit 1 +npm install --silent +npm run --silent build-js +cp "${ROOT}/web/dest/index.html" "${ROOT}/server/web/pages/template/pages/" +cd .. + +sudo docker run --rm -v "$PWD":/usr/src/torr -w /usr/src/torr golang:1.16 ./build-all.sh +sudo chmod 0777 ./dist/* \ No newline at end of file From ab8d4fa9b001ae9eebb8d1c8f084fd9145f998c4 Mon Sep 17 00:00:00 2001 From: YouROK <8yourok8@mail.ru> Date: Tue, 8 Jun 2021 19:38:49 +0300 Subject: [PATCH 4/4] MatriX.98 --- server/version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/version/version.go b/server/version/version.go index d5ba2f0..3b7111f 100644 --- a/server/version/version.go +++ b/server/version/version.go @@ -1,3 +1,3 @@ package version -const Version = "MatriX.97" +const Version = "MatriX.98"