From b6cdbacaca4c4173d50ddafb1a9dc8ddaa74bab7 Mon Sep 17 00:00:00 2001 From: nikk gitanes Date: Mon, 7 Jun 2021 19:03:36 +0300 Subject: [PATCH] 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": "Загрузить файл",