fix: translate UI elements in menu and uptime page
- Added translations for sidebar menu items in all languages - Fixed "Create new" button to use translation instead of hardcoded text - Added missing translations for "Bulk Import" in Russian and Turkish - Translated status box labels (UP, DOWN, PAUSED) in the uptime monitors page - Made greeting component fully translatable with proper context - Fixed lint warnings in components
This commit is contained in:
1 parent
3a574b2f4e
commit
13c4390f96
6 files changed
+66
-18
No files matched your search
@@ -6,7 +6,7 @@ import { useTheme } from "@emotion/react";
|
||||
|
||||
const CreateMonitorHeader = ({
|
||||
isAdmin,
|
||||
label = "Create new",
|
||||
label,
|
||||
isLoading = true,
|
||||
path,
|
||||
bulkPath,
|
||||
@@ -14,6 +14,8 @@ const CreateMonitorHeader = ({
|
||||
const navigate = useNavigate();
|
||||
const { t } = useTranslation();
|
||||
const theme = useTheme();
|
||||
|
||||
// Use the provided label or fall back to the translated default
|
||||
|
||||
if (!isAdmin) return null;
|
||||
|
||||
@@ -30,7 +32,7 @@ const CreateMonitorHeader = ({
|
||||
color="accent"
|
||||
onClick={() => navigate(path)}
|
||||
>
|
||||
{label}
|
||||
{label || t("createNew")}
|
||||
</Button>
|
||||
{bulkPath && (
|
||||
<Button
|
||||
|
||||
@@ -2,10 +2,12 @@ import PropTypes from "prop-types";
|
||||
import { Stack } from "@mui/material";
|
||||
import StatusBox from "./statusBox";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import SkeletonLayout from "./skeleton";
|
||||
|
||||
const StatusBoxes = ({ shouldRender, monitorsSummary }) => {
|
||||
const theme = useTheme();
|
||||
const { t } = useTranslation();
|
||||
if (!shouldRender) return <SkeletonLayout shouldRender={shouldRender} />;
|
||||
return (
|
||||
<Stack
|
||||
@@ -14,15 +16,15 @@ const StatusBoxes = ({ shouldRender, monitorsSummary }) => {
|
||||
justifyContent="space-between"
|
||||
>
|
||||
<StatusBox
|
||||
title="up"
|
||||
title={t("monitorStatus.up").toUpperCase()}
|
||||
value={monitorsSummary?.upMonitors ?? 0}
|
||||
/>
|
||||
<StatusBox
|
||||
title="down"
|
||||
title={t("monitorStatus.down").toUpperCase()}
|
||||
value={monitorsSummary?.downMonitors ?? 0}
|
||||
/>
|
||||
<StatusBox
|
||||
title="paused"
|
||||
title={t("monitorStatus.paused").toUpperCase()}
|
||||
value={monitorsSummary?.pausedMonitors ?? 0}
|
||||
/>
|
||||
</Stack>
|
||||
@@ -31,6 +33,7 @@ const StatusBoxes = ({ shouldRender, monitorsSummary }) => {
|
||||
|
||||
StatusBoxes.propTypes = {
|
||||
monitorsSummary: PropTypes.object,
|
||||
shouldRender: PropTypes.bool,
|
||||
};
|
||||
|
||||
export default StatusBoxes;
|
||||
@@ -3,6 +3,7 @@ import { useTheme } from "@emotion/react";
|
||||
import { Box, Typography } from "@mui/material";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { setGreeting } from "../Features/UI/uiSlice";
|
||||
|
||||
const early = [
|
||||
@@ -133,6 +134,7 @@ const evening = [
|
||||
const Greeting = ({ type = "" }) => {
|
||||
const theme = useTheme();
|
||||
const dispatch = useDispatch();
|
||||
const { t } = useTranslation();
|
||||
const { firstName } = useSelector((state) => state.auth.user);
|
||||
const index = useSelector((state) => state.ui.greeting.index);
|
||||
const lastUpdate = useSelector((state) => state.ui.greeting.lastUpdate);
|
||||
@@ -147,7 +149,7 @@ const Greeting = ({ type = "" }) => {
|
||||
let random = Math.floor(Math.random() * 5);
|
||||
dispatch(setGreeting({ index: random, lastUpdate: hour }));
|
||||
}
|
||||
}, [dispatch, hour]);
|
||||
}, [dispatch, hour, lastUpdate]);
|
||||
|
||||
let greetingArray =
|
||||
hour < 6 ? early : hour < 12 ? morning : hour < 18 ? afternoon : evening;
|
||||
@@ -165,7 +167,7 @@ const Greeting = ({ type = "" }) => {
|
||||
fontSize="inherit"
|
||||
color={theme.palette.primary.contrastTextTertiary}
|
||||
>
|
||||
{prepend},{" "}
|
||||
{t("greeting.prepend", { defaultValue: prepend })}, {" "}
|
||||
</Typography>
|
||||
<Typography
|
||||
component="span"
|
||||
@@ -181,7 +183,7 @@ const Greeting = ({ type = "" }) => {
|
||||
lineHeight={1}
|
||||
color={theme.palette.primary.contrastTextTertiary}
|
||||
>
|
||||
{append} — Here’s an overview of your {type} monitors.
|
||||
{t("greeting.append", { defaultValue: append })} — {t("greeting.overview", { type: t(`menu.${type}`) })}
|
||||
</Typography>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -441,6 +441,16 @@
|
||||
"pageSpeedApiKeyFieldResetLabel": "API key is set. Click Reset to change it.",
|
||||
"reset": "Reset",
|
||||
"createNew": "Create new",
|
||||
"greeting": {
|
||||
"prepend": "Hey there",
|
||||
"append": "The afternoon is your playground—let's make it epic!",
|
||||
"overview": "Here's an overview of your {{type}} monitors."
|
||||
},
|
||||
"monitorStatus": {
|
||||
"up": "up",
|
||||
"down": "down",
|
||||
"paused": "paused"
|
||||
},
|
||||
"monitorState": {
|
||||
"paused": "paused",
|
||||
"resumed": "resumed"
|
||||
|
||||
@@ -65,7 +65,18 @@
|
||||
"authRegisterLastName": "Фамилия",
|
||||
"authRegisterEmail": "Эл. почта",
|
||||
"authRegisterEmailRequired": "Чтобы продолжить, пожалуйста, введите ваш адрес электронной почты",
|
||||
"authRegisterEmailInvalid": "Пожалуйста, введите корректный адрес электронной почты",
|
||||
"authRegisterEmailInvalid": "Пожалуйста, введите действительный адрес электронной почты",
|
||||
"bulkImport": {
|
||||
"title": "Массовый импорт",
|
||||
"selectFileTips": "Выберите CSV-файл для загрузки",
|
||||
"selectFileDescription": "Вы можете скачать наш <template>шаблон</template> или <sample>пример</sample>",
|
||||
"selectFile": "Выбрать файл",
|
||||
"parsingFailed": "Ошибка анализа",
|
||||
"uploadSuccess": "Мониторы успешно созданы!",
|
||||
"validationFailed": "Ошибка проверки",
|
||||
"noFileSelected": "Файл не выбран",
|
||||
"fallbackPage": "Импортируйте файл для загрузки списка серверов"
|
||||
},
|
||||
"distributedStatusHeaderText": "Охват реального времени и реального устройства",
|
||||
"distributedStatusSubHeaderText": "Работает на миллионах устройств по всему миру, просматривайте производительность системы по глобальному региону, стране или городу",
|
||||
"settingsGeneralSettings": "Общие настройки",
|
||||
@@ -395,6 +406,16 @@
|
||||
"pageSpeedLearnMoreLink": "Нажмите здесь, чтобы узнать",
|
||||
"pageSpeedAddApiKey": "как добавить ваш ключ API.",
|
||||
"createNew": "Создать новый",
|
||||
"greeting": {
|
||||
"prepend": "Привет",
|
||||
"append": "День прекрасен для новых достижений!",
|
||||
"overview": "Вот обзор ваших мониторов {{type}}."
|
||||
},
|
||||
"monitorStatus": {
|
||||
"up": "работает",
|
||||
"down": "не работает",
|
||||
"paused": "приостановлен"
|
||||
},
|
||||
"monitorState": {
|
||||
"paused": "приостановлен",
|
||||
"resumed": "возобновлен"
|
||||
|
||||
@@ -418,17 +418,27 @@
|
||||
"authRegisterEmailRequired": "Devam etmek için lütfen e-posta adresinizi girin",
|
||||
"authRegisterEmailInvalid": "Lütfen geçerli bir e-posta adresi girin",
|
||||
"bulkImport": {
|
||||
"title": "",
|
||||
"selectFileTips": "",
|
||||
"selectFileDescription": "",
|
||||
"selectFile": "",
|
||||
"parsingFailed": "",
|
||||
"uploadSuccess": "",
|
||||
"validationFailed": "",
|
||||
"noFileSelected": "",
|
||||
"fallbackPage": ""
|
||||
"title": "Toplu İçe Aktar",
|
||||
"selectFileTips": "Yüklemek için CSV dosyası seçin",
|
||||
"selectFileDescription": "<template>Şablonumuzu</template> veya <sample>örneğimizi</sample> indirebilirsiniz",
|
||||
"selectFile": "Dosya Seç",
|
||||
"parsingFailed": "Ayrıştırma başarısız oldu",
|
||||
"uploadSuccess": "Monitörler başarıyla oluşturuldu!",
|
||||
"validationFailed": "Doğrulama başarısız oldu",
|
||||
"noFileSelected": "Dosya seçilmedi",
|
||||
"fallbackPage": "Sunucuların listesini toplu olarak yüklemek için bir dosya içe aktarın"
|
||||
},
|
||||
"createNew": "Yeni oluştur",
|
||||
"greeting": {
|
||||
"prepend": "Merhaba",
|
||||
"append": "Öğleden sonra senin oyun alanın—hadi onu muhteşem yapalım!",
|
||||
"overview": "İşte {{type}} monitörlerinizin genel görünümü."
|
||||
},
|
||||
"monitorStatus": {
|
||||
"up": "aktif",
|
||||
"down": "devre dışı",
|
||||
"paused": "duraklatıldı"
|
||||
},
|
||||
"monitorState": {
|
||||
"paused": "duraklatıldı",
|
||||
"resumed": "devam ettirildi"
|
||||
|
||||
Reference in new issue
Block a user