refactor(i18n): Extracted multiple fields in the Service component for translation.

- Extracted multiple fields in the Service component for translation.
- Optimized the structure of the translation file, categorizing it by functional modules.
This commit is contained in:
YiZixuan
2025-08-17 15:19:01 +08:00
parent b068c0cd51
commit 6bf75b2bf7
15 changed files with 319 additions and 92 deletions
@@ -37,7 +37,7 @@ export function ServiceConfigFields({ form }: ServiceConfigFieldsProps) {
name="interval"
render={({ field }) => (
<FormItem>
<FormLabel>Check Interval</FormLabel>
<FormLabel>{t("checkInterval")}</FormLabel>
{!isCustomInterval ? (
<FormControl>
<Select onValueChange={handleIntervalChange} value={isCustomInterval ? "custom" : field.value}>
@@ -45,13 +45,13 @@ export function ServiceConfigFields({ form }: ServiceConfigFieldsProps) {
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="30">30 seconds</SelectItem>
<SelectItem value="60">1 minute</SelectItem>
<SelectItem value="300">5 minutes</SelectItem>
<SelectItem value="900">15 minutes</SelectItem>
<SelectItem value="1800">30 minutes</SelectItem>
<SelectItem value="3600">1 hour</SelectItem>
<SelectItem value="custom">Custom</SelectItem>
<SelectItem value="30">30 {t("seconds")}</SelectItem>
<SelectItem value="60">1 {t("minute")}</SelectItem>
<SelectItem value="300">5 {t("minutes")}</SelectItem>
<SelectItem value="900">15 {t("minutes")}</SelectItem>
<SelectItem value="1800">30 {t("minutes")}</SelectItem>
<SelectItem value="3600">1 {t("hour")}</SelectItem>
<SelectItem value="custom">{t("custom")}</SelectItem>
</SelectContent>
</Select>
</FormControl>
@@ -60,7 +60,7 @@ export function ServiceConfigFields({ form }: ServiceConfigFieldsProps) {
<FormControl>
<Input
type="number"
placeholder="Enter interval in seconds"
placeholder={t("checkIntervalPlaceholder")}
value={field.value}
onChange={field.onChange}
min="10"
@@ -74,14 +74,14 @@ export function ServiceConfigFields({ form }: ServiceConfigFieldsProps) {
}}
className="text-sm text-blue-600 hover:text-blue-800"
>
Back to presets
{t("backToPresets")}
</button>
</div>
)}
<FormDescription className="text-xs">
{isCustomInterval
? "Enter custom interval in seconds (minimum 10 seconds)"
: "How often to check the service status"
? t("checkIntervalDescCustom")
: t("checkIntervalDesc")
}
</FormDescription>
<FormMessage />
@@ -94,22 +94,22 @@ export function ServiceConfigFields({ form }: ServiceConfigFieldsProps) {
name="retries"
render={({ field }) => (
<FormItem>
<FormLabel>Retry Attempts</FormLabel>
<FormLabel>{t("retryAttempts")}</FormLabel>
<FormControl>
<Select onValueChange={field.onChange} defaultValue={field.value}>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="1">1 attempt</SelectItem>
<SelectItem value="2">2 attempts</SelectItem>
<SelectItem value="3">3 attempts</SelectItem>
<SelectItem value="5">5 attempts</SelectItem>
<SelectItem value="1">1 {t("attempt")}</SelectItem>
<SelectItem value="2">2 {t("attempts")}</SelectItem>
<SelectItem value="3">3 {t("attempts")}</SelectItem>
<SelectItem value="5">5 {t("attempts")}</SelectItem>
</SelectContent>
</Select>
</FormControl>
<FormDescription className="text-xs">
Number of retry attempts before marking as down
{t("retryAttemptsDesc")}
</FormDescription>
<FormMessage />
</FormItem>
@@ -150,7 +150,7 @@ export function ServiceForm({
<ServiceFormActions
isSubmitting={isSubmitting}
onCancel={onCancel}
submitLabel={isEdit ? "Update Service" : "Create Service"}
submitLabel={isEdit ? t("updateService") : t("createService")}
/>
</form>
</Form>
@@ -9,12 +9,14 @@ import { useQuery } from "@tanstack/react-query";
import { alertConfigService, AlertConfiguration } from "@/services/alertConfigService";
import { serviceNotificationTemplateService, ServiceNotificationTemplate } from "@/services/serviceNotificationTemplateService";
import { useState, useEffect } from "react";
import { useLanguage } from "@/contexts/LanguageContext.tsx";
interface ServiceNotificationFieldsProps {
form: UseFormReturn<ServiceFormData>;
}
export function ServiceNotificationFields({ form }: ServiceNotificationFieldsProps) {
const { t } = useLanguage();
const [alertConfigs, setAlertConfigs] = useState<AlertConfiguration[]>([]);
// Get the current form values for debugging
@@ -88,10 +90,10 @@ export function ServiceNotificationFields({ form }: ServiceNotificationFieldsPro
<FormItem className="flex flex-row items-center justify-between rounded-lg border p-4">
<div className="space-y-0.5">
<FormLabel className="text-base">
Enable Notifications
{t("enableNotifications")}
</FormLabel>
<FormDescription>
Enable or disable notifications for this service
{t("enableNotificationsDesc")}
</FormDescription>
</div>
<FormControl>
@@ -115,11 +117,11 @@ export function ServiceNotificationFields({ form }: ServiceNotificationFieldsPro
name="notificationChannels"
render={({ field }) => (
<FormItem>
<FormLabel>Notification Channels</FormLabel>
<FormLabel>{t("notificationChannels")}</FormLabel>
<FormDescription>
{notificationStatus === "enabled"
? "Select notification channels for this service"
: "Enable notifications first to select channels"}
? t("notificationChannelsEnabledDesc")
: t("notificationChannelsDesc")}
</FormDescription>
{/* Display selected channels as badges */}
@@ -144,7 +146,7 @@ export function ServiceNotificationFields({ form }: ServiceNotificationFieldsPro
value="" // Always reset to empty after selection
>
<SelectTrigger className={notificationStatus !== "enabled" ? 'opacity-50' : ''}>
<SelectValue placeholder="Add a notification channel" />
<SelectValue placeholder={t("notificationChannelsPlaceholder")} />
</SelectTrigger>
<SelectContent>
{alertConfigs
@@ -169,7 +171,7 @@ export function ServiceNotificationFields({ form }: ServiceNotificationFieldsPro
return (
<FormItem>
<FormLabel>Alert Template</FormLabel>
<FormLabel>{t("alertTemplate")}</FormLabel>
<FormControl>
<Select
onValueChange={(value) => {
@@ -179,7 +181,7 @@ export function ServiceNotificationFields({ form }: ServiceNotificationFieldsPro
disabled={notificationStatus !== "enabled" || isLoadingTemplates}
>
<SelectTrigger className={notificationStatus !== "enabled" ? 'opacity-50' : ''}>
<SelectValue placeholder={isLoadingTemplates ? "Loading templates..." : "Select an alert template"} />
<SelectValue placeholder={isLoadingTemplates ? t("alertTemplateLoading") : t("alertTemplatePlaceholder")} />
</SelectTrigger>
<SelectContent>
{serviceTemplates?.map((template) => (
@@ -192,8 +194,8 @@ export function ServiceNotificationFields({ form }: ServiceNotificationFieldsPro
</FormControl>
<FormDescription>
{notificationStatus === "enabled"
? "Choose a template for alert messages"
: "Enable notifications first to select template"}
? t("alertTemplateEnabledDesc")
: t("alertTemplateDesc")}
</FormDescription>
</FormItem>
);
@@ -9,12 +9,14 @@ import { regionalService } from "@/services/regionalService";
import { MapPin, Loader2, X, Plus } from "lucide-react";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { useLanguage } from "@/contexts/LanguageContext.tsx";
interface ServiceRegionalFieldsProps {
form: UseFormReturn<ServiceFormData>;
}
export function ServiceRegionalFields({ form }: ServiceRegionalFieldsProps) {
const { t } = useLanguage();
const regionalMonitoringEnabled = form.watch("regionalMonitoringEnabled");
const currentRegionalAgents = form.watch("regionalAgents") || [];
@@ -79,10 +81,10 @@ export function ServiceRegionalFields({ form }: ServiceRegionalFieldsProps) {
<div className="space-y-0.5">
<FormLabel className="text-base font-medium flex items-center gap-2">
<MapPin className="h-4 w-4" />
Regional Monitoring
{t("regionalMonitoring")}
</FormLabel>
<div className="text-sm text-muted-foreground">
Assign this service to regional monitoring agents for distributed monitoring
{t("regionalMonitoringDesc")}
</div>
</div>
<FormControl>
@@ -107,7 +109,7 @@ export function ServiceRegionalFields({ form }: ServiceRegionalFieldsProps) {
name="regionalAgents"
render={({ field }) => (
<FormItem>
<FormLabel>Regional Agents</FormLabel>
<FormLabel>{t("regionalAgents")}</FormLabel>
{/* Display selected agents */}
{currentRegionalAgents.length > 0 && (
@@ -140,12 +142,12 @@ export function ServiceRegionalFields({ form }: ServiceRegionalFieldsProps) {
<SelectTrigger>
<SelectValue placeholder={
isLoading
? "Loading agents..."
? t("regionalAgentsLoading")
: availableAgents.length > 0
? "Select additional regional agents..."
? t("regionalAgentsAvailablePlaceholder")
: currentRegionalAgents.length > 0
? "All available agents selected"
: "No regional agents available"
? t("regionalAgentsAllSelected")
: t("regionalAgentsNoAvailable")
} />
</SelectTrigger>
</FormControl>
@@ -154,14 +156,14 @@ export function ServiceRegionalFields({ form }: ServiceRegionalFieldsProps) {
<SelectItem value="loading" disabled>
<div className="flex items-center gap-2">
<Loader2 className="h-4 w-4 animate-spin" />
Loading agents...
t("regionalAgentsLoading")
</div>
</SelectItem>
) : availableAgents.length === 0 ? (
<SelectItem value="no-agents" disabled>
{currentRegionalAgents.length > 0
? "All available agents selected"
: "No online regional agents available"
? t("regionalAgentsAllSelected")
: t("regionalAgentsNoOnlineAvailable")
}
</SelectItem>
) : (
@@ -190,13 +192,13 @@ export function ServiceRegionalFields({ form }: ServiceRegionalFieldsProps) {
{regionalMonitoringEnabled && onlineAgents.length === 0 && !isLoading && (
<p className="text-sm text-amber-600">
No online regional agents found. Services will use default monitoring.
{t("regionalAgentsNotFoundMessage")}
</p>
)}
{currentRegionalAgents.length === 0 && regionalMonitoringEnabled && (
<p className="text-sm text-orange-600">
No regional agents selected. Service will use default monitoring.
{t("regionalAgentsNotSelectedMessage")}
</p>
)}
@@ -4,12 +4,14 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@
import { Globe, Wifi, Server, Globe2 } from "lucide-react";
import { UseFormReturn } from "react-hook-form";
import { ServiceFormData } from "./types";
import { useLanguage } from "@/contexts/LanguageContext.tsx";
interface ServiceTypeFieldProps {
form: UseFormReturn<ServiceFormData>;
}
export function ServiceTypeField({ form }: ServiceTypeFieldProps) {
const { t } = useLanguage();
const getServiceIcon = (type: string) => {
switch (type) {
case "http":
@@ -31,7 +33,7 @@ export function ServiceTypeField({ form }: ServiceTypeFieldProps) {
name="type"
render={({ field }) => (
<FormItem>
<FormLabel>Service Type</FormLabel>
<FormLabel>{t("serviceType")}</FormLabel>
<FormControl>
<Select
onValueChange={field.onChange}
@@ -56,7 +58,7 @@ export function ServiceTypeField({ form }: ServiceTypeFieldProps) {
<span>HTTP/S</span>
</div>
<p className="text-xs text-muted-foreground mt-1">
Monitor websites and REST APIs with HTTP/HTTPS Protocol
{t("serviceTypeHTTPDesc")}
</p>
</div>
</SelectItem>
@@ -67,7 +69,7 @@ export function ServiceTypeField({ form }: ServiceTypeFieldProps) {
<span>PING</span>
</div>
<p className="text-xs text-muted-foreground mt-1">
Monitor host availability with PING Protocol
{t("serviceTypePINGDesc")}
</p>
</div>
</SelectItem>
@@ -78,7 +80,7 @@ export function ServiceTypeField({ form }: ServiceTypeFieldProps) {
<span>TCP</span>
</div>
<p className="text-xs text-muted-foreground mt-1">
Monitor TCP port connectivity with TCP Protocol
{t("serviceTypeTCPDesc")}
</p>
</div>
</SelectItem>
@@ -89,7 +91,7 @@ export function ServiceTypeField({ form }: ServiceTypeFieldProps) {
<span>DNS</span>
</div>
<p className="text-xs text-muted-foreground mt-1">
Monitor DNS resolution
{t("serviceTypeDNSDesc")}
</p>
</div>
</SelectItem>
@@ -3,12 +3,14 @@ import { FormControl, FormField, FormItem, FormLabel, FormMessage, FormDescripti
import { Input } from "@/components/ui/input";
import { UseFormReturn } from "react-hook-form";
import { ServiceFormData } from "./types";
import { useLanguage } from "@/contexts/LanguageContext.tsx";
interface ServiceUrlFieldProps {
form: UseFormReturn<ServiceFormData>;
}
export function ServiceUrlField({ form }: ServiceUrlFieldProps) {
const { t } = useLanguage();
const serviceType = form.watch("type");
const getPlaceholder = () => {
@@ -22,35 +24,35 @@ export function ServiceUrlField({ form }: ServiceUrlFieldProps) {
case "dns":
return "example.com";
default:
return "Enter URL or hostname";
return t("targetDefaultPlaceholder");
}
};
const getDescription = () => {
switch (serviceType) {
case "http":
return "Enter the full URL including protocol (http:// or https://)";
return t("targetHTTPDesc");
case "ping":
return "Enter hostname or IP address to ping";
return t("targetPINGDesc");
case "tcp":
return "Enter hostname or IP address for TCP connection test";
return t("targetTCPDesc");
case "dns":
return "Enter domain name for DNS record monitoring (A, AAAA, MX, etc.)";
return t("targetDNSDesc");
default:
return "Enter the target URL or hostname for monitoring";
return t("targetDefaultDesc");
}
};
const getFieldLabel = () => {
switch (serviceType) {
case "dns":
return "Domain Name";
return t("targetDNS");
case "ping":
return "Hostname/IP";
case "tcp":
return "Hostname/IP";
default:
return "Target URL/Host";
return t("targetDefault");
}
};
@@ -99,7 +101,7 @@ export function ServiceUrlField({ form }: ServiceUrlFieldProps) {
/>
</FormControl>
<FormDescription className="text-xs">
Enter the port number for TCP connection test
{t("targetTCPPortDesc")}
</FormDescription>
<FormMessage />
</FormItem>
@@ -170,7 +170,7 @@ const DataRetentionSettings = () => {
<Alert className="border-blue-200 bg-blue-50 dark:bg-blue-950 dark:border-blue-800">
<AlertTriangle className="h-5 w-5 text-blue-600 dark:text-blue-400" />
<AlertDescription className="text-blue-700 dark:text-blue-300">
<span className="font-medium">Permission Notice:</span> As an admin user, you do not have access to data retention settings. These settings can only be accessed and modified by Super Admins.
<span className="font-medium">{t("permissionNotice")}</span> As an admin user, you do not have access to data retention settings. These settings can only be accessed and modified by Super Admins.
</AlertDescription>
</Alert>
</CardContent>
@@ -143,7 +143,7 @@ const GeneralSettingsPanel: React.FC<GeneralSettingsPanelProps> = () => {
<Alert className="border-blue-200 bg-blue-50 dark:bg-blue-950 dark:border-blue-800">
<ShieldAlert className="h-5 w-5 text-blue-600 dark:text-blue-400" />
<AlertDescription className="text-blue-700 dark:text-blue-300">
<span className="font-medium">Permission Notice:</span> As an admin user, you do not have access to view or modify system and mail settings. These settings can only be accessed and modified by Super Admins. Contact your Super Admin if you need to make changes to system configuration or mail settings.
<span className="font-medium">{t("permissionNotice")}</span> {t("permissionNoticeAddUser")}
</AlertDescription>
</Alert>
</CardContent>
@@ -153,11 +153,11 @@ const GeneralSettingsPanel: React.FC<GeneralSettingsPanelProps> = () => {
}
if (isLoading) {
return <div className="p-4">Loading settings...</div>;
return <div className="p-4">{t("loadingSettings")}</div>;
}
if (error) {
return <div className="p-4 text-red-500">Error loading settings</div>;
return <div className="p-4 text-red-500">{t("loadingSettingsError")}</div>;
}
return (
@@ -10,7 +10,10 @@ import { UserCog, Loader2, AlertCircle, Info, Users, ShieldAlert } from "lucide-
import { Button } from "@/components/ui/button";
import { Alert, AlertDescription } from "@/components/ui/alert";
import { authService } from "@/services/authService";
import { useLanguage } from "@/contexts/LanguageContext.tsx";
const UserManagement = () => {
const { t } = useLanguage();
const {
users,
loading,
@@ -44,21 +47,21 @@ const UserManagement = () => {
<AccordionTrigger className="py-4 px-5 bg-card hover:bg-card/90 hover:no-underline rounded-lg text-lg font-medium flex items-center w-full">
<div className="flex items-center">
<UserCog className="h-5 w-5 mr-2 text-green-500" />
<span>User Management</span>
<span>{t("userManagement")}</span>
</div>
</AccordionTrigger>
<AccordionContent className="p-4 pt-6 bg-background rounded-b-lg">
<div className="flex justify-between items-center mb-6">
<h2 className="text-2xl font-bold">User Management</h2>
<h2 className="text-2xl font-bold">{t("userManagement")}</h2>
{isSuperAdmin && <button onClick={() => setIsAddUserDialogOpen(true)} className="bg-green-500 hover:bg-green-600 text-white py-2 px-4 rounded-md flex items-center">
<span className="mr-1">+</span> Add User
<span className="mr-1">+</span> {t("addUser")}
</button>}
</div>
{!isSuperAdmin && <Alert className="mb-6 border-blue-200 bg-blue-50 dark:bg-blue-950 dark:border-blue-800">
<ShieldAlert className="h-5 w-5 text-blue-600 dark:text-blue-400" />
<AlertDescription className="text-blue-700 dark:text-blue-300">
<span className="font-medium">Permission Notice:</span> As an admin user, you have access to view and modify existing user details. However, only Super Admins have permission to create new user accounts. Contact your Super Admin if you need to add a new user.
<span className="font-medium">{t("permissionNotice")}</span> As an admin user, you have access to view and modify existing user details. However, only Super Admins have permission to create new user accounts. Contact your Super Admin if you need to add a new user.
</AlertDescription>
</Alert>}
+68 -3
View File
@@ -2,9 +2,6 @@
import { ServicesTranslations } from '../types/services';
export const servicesTranslations: ServicesTranslations = {
serviceName: "Service Name",
serviceNameDesc: "Enter a descriptive name for your service",
serviceType: "Service Type",
serviceStatus: "Service Status",
responseTime: "Response Time",
uptime: "Uptime",
@@ -19,4 +16,72 @@ export const servicesTranslations: ServicesTranslations = {
allTypes: "All Types",
createNewService: "Create New Service",
createNewServiceDesc: "Fill in the details to create a new service to monitor.",
// ServiceBasicFields.tsx
serviceName: "Service Name",
serviceNameDesc: "Enter a descriptive name for your service",
// ServiceConfigFields.tsx
checkInterval: "Check Interval",
seconds: "seconds",
minute: "minute",
minutes: "minutes",
hour: "hour",
hours: "hours",
custom: "Custom",
checkIntervalPlaceholder: "Enter interval in seconds",
backToPresets: "Back to presets",
checkIntervalDesc: "How often to check the service status",
checkIntervalDescCustom: "Enter custom interval in seconds (minimum 10 seconds)",
retryAttempts: "Retry Attempts",
attempt: "attempt",
attempts: "attempts",
retryAttemptsDesc: "Number of retry attempts before marking as down",
// ServiceForm.tsx
updateService: "Update Service",
createService: "Create Service",
// ServiceNotificationFields.tsx
enableNotifications: "Enable Notifications",
enableNotificationsDesc: "Enable or disable notifications for this service",
notificationChannels: "Notification Channels",
notificationChannelsEnabledDesc: "Select notification channels for this service",
notificationChannelsDesc: "Enable notifications first to select channels",
notificationChannelsPlaceholder: "Add a notification channel",
alertTemplate: "Alert Template",
alertTemplateLoading: "Loading templates...",
alertTemplatePlaceholder: "Select an alert template",
alertTemplateEnabledDesc: "Choose a template for alert messages",
alertTemplateDesc: "Enable notifications first to select template",
// ServiceTypeField.tsx
serviceType: "Service Type",
serviceTypeHTTPDesc: "Monitor websites and REST APIs with HTTP/HTTPS Protocol",
serviceTypePINGDesc: "Monitor host availability with PING Protocol",
serviceTypeTCPDesc: "Monitor TCP port connectivity with TCP Protocol",
serviceTypeDNSDesc: "Monitor DNS resolution",
// ServiceRegionalFields.tsx
regionalMonitoring: "Regional Monitoring",
regionalMonitoringDesc: "Assign this service to regional monitoring agents for distributed monitoring",
regionalAgents: "Regional Agents",
regionalAgentsLoading: "Loading agents...",
regionalAgentsAvailablePlaceholder: "Select additional regional agents...",
regionalAgentsAllSelected: "All available agents selected",
regionalAgentsNoAvailable: "No regional agents available",
regionalAgentsNoOnlineAvailable: "No online regional agents available",
regionalAgentsNotFoundMessage: "No online regional agents found. Services will use default monitoring.",
regionalAgentsNotSelectedMessage: "No regional agents selected. Service will use default monitoring.",
// ServiceUrlField.tsx
targetDefault: "Target URL/Host",
targetDNS: "Domain Name",
targetHTTPDesc: "Enter the full URL including protocol (http:// or https://)",
targetPINGDesc: "Enter hostname or IP address to ping",
targetTCPDesc: "Enter hostname or IP address for TCP connection test",
targetTCPPortDesc: "Enter the port number for TCP connection test",
targetDNSDesc: "Enter domain name for DNS record monitoring (A, AAAA, MX, etc.)",
targetDefaultDesc: "Enter the target URL or hostname for monitoring",
targetDefaultPlaceholder: "Enter URL or hostname",
};
+13 -6
View File
@@ -2,18 +2,18 @@
import { SettingsTranslations } from '../types/settings';
export const settingsTranslations: SettingsTranslations = {
// Tabs
// General Settings - Tabs
systemSettings: "System Settings",
mailSettings: "Mail Settings",
// System Settings
// General Settings - System Settings
appName: "Application Name",
appURL: "Application URL",
senderName: "Sender Name",
senderEmail: "Sender Email Address",
hideControls: "Hide Controls",
// Mail Settings
// General Settings - Mail Settings
smtpSettings: "SMTP Configuration",
smtpEnabled: "Enable SMTP",
smtpHost: "SMTP Host",
@@ -24,7 +24,7 @@ export const settingsTranslations: SettingsTranslations = {
enableTLS: "Enable TLS",
localName: "Local Name",
// Test Email
// General Settings - Test Email
testEmail: "Test Email",
sendTestEmail: "Send test email",
emailTemplate: "Email template",
@@ -39,7 +39,7 @@ export const settingsTranslations: SettingsTranslations = {
enterEmailAddress: "Enter email address",
sending: "Sending...",
// Actions and status
// General Settings - Actions and status
save: "Save Changes",
saving: "Saving...",
settingsUpdated: "Settings updated successfully",
@@ -48,5 +48,12 @@ export const settingsTranslations: SettingsTranslations = {
testConnection: "Test Connection",
testingConnection: "Testing Connection...",
connectionSuccess: "Connection successful",
connectionFailed: "Connection failed"
connectionFailed: "Connection failed",
// User Management
addUser: "Add User",
permissionNotice: "Permission Notice:",
permissionNoticeAddUser: "As an admin user, you do not have access to view or modify system and mail settings. These settings can only be accessed and modified by Super Admins. Contact your Super Admin if you need to make changes to system configuration or mail settings.",
loadingSettings: "Loading settings...",
loadingSettingsError: "Error loading settings",
};
+68 -3
View File
@@ -1,8 +1,6 @@
export interface ServicesTranslations {
serviceName: string;
serviceNameDesc: string;
serviceType: string;
serviceStatus: string;
responseTime: string;
uptime: string;
@@ -17,4 +15,71 @@ export interface ServicesTranslations {
allTypes: string;
createNewService: string;
createNewServiceDesc: string;
// ServiceBasicFields.tsx
serviceName: string;
serviceNameDesc: string;
// ServiceConfigFields.tsx
checkInterval: string;
seconds: string;
minute: string;
minutes: string;
hour: string;
hours: string;
custom: string;
checkIntervalPlaceholder: string;
backToPresets: string;
checkIntervalDesc: string;
checkIntervalDescCustom: string;
retryAttempts: string;
attempt: string;
attempts: string;
retryAttemptsDesc: string;
// ServiceForm.tsx
updateService: string;
createService: string;
// ServiceNotificationFields.tsx
enableNotifications: string;
enableNotificationsDesc: string;
notificationChannels: string;
notificationChannelsEnabledDesc: string;
notificationChannelsDesc: string;
notificationChannelsPlaceholder: string;
alertTemplate: string;
alertTemplateLoading: string;
alertTemplatePlaceholder: string;
alertTemplateEnabledDesc: string;
alertTemplateDesc: string;
// ServiceTypeField.tsx
serviceType: string;
serviceTypeHTTPDesc: string;
serviceTypePINGDesc: string;
serviceTypeTCPDesc: string;
serviceTypeDNSDesc: string;
// ServiceRegionalFields.tsx
regionalMonitoring: string;
regionalMonitoringDesc: string;
regionalAgents: string;
regionalAgentsLoading: string;
regionalAgentsAvailablePlaceholder: string;
regionalAgentsAllSelected: string;
regionalAgentsNoAvailable: string;
regionalAgentsNotFoundMessage: string;
regionalAgentsNotSelectedMessage: string;
// ServiceUrlField.tsx
targetDefault: string;
targetDNS: string;
targetHTTPDesc: string;
targetPINGDesc: string;
targetTCPDesc: string;
targetTCPPortDesc: string;
targetDNSDesc: string;
targetDefaultDesc: string;
targetDefaultPlaceholder: string;
}
+12 -5
View File
@@ -1,17 +1,17 @@
export interface SettingsTranslations {
// Tabs
// General Settings - Tabs
systemSettings: string;
mailSettings: string;
// System Settings
// General Settings - System Settings
appName: string;
appURL: string;
senderName: string;
senderEmail: string;
hideControls: string;
// Mail Settings
// General Settings - Mail Settings
smtpSettings?: string;
smtpEnabled: string;
smtpHost: string;
@@ -22,7 +22,7 @@ export interface SettingsTranslations {
enableTLS: string;
localName: string;
// Test Email
// General Settings - Test Email
testEmail: string;
sendTestEmail: string;
emailTemplate: string;
@@ -37,7 +37,7 @@ export interface SettingsTranslations {
enterEmailAddress: string;
sending: string;
// Actions and status
// General Settings - Actions and status
save: string;
saving: string;
settingsUpdated: string;
@@ -47,4 +47,11 @@ export interface SettingsTranslations {
testingConnection: string;
connectionSuccess: string;
connectionFailed: string;
// User Management
addUser: string;
permissionNotice: string;
permissionNoticeAddUser: string;
loadingSettings: string;
loadingSettingsError: string;
}
+70 -5
View File
@@ -2,12 +2,9 @@
import { ServicesTranslations } from '../types/services';
export const servicesTranslations: ServicesTranslations = {
serviceName: "服务名称",
serviceNameDesc: "为你的服务输入一个描述性名称",
serviceType: "服务类型",
serviceStatus: "服务状态",
responseTime: "响应时间",
uptime: "在线",
uptime: "在线时间",
lastChecked: "最后检查时间",
noServices: "没有符合您筛选条件的服务。",
currentlyMonitoring: "当前监控",
@@ -19,4 +16,72 @@ export const servicesTranslations: ServicesTranslations = {
allTypes: "所有类型",
createNewService: "添加新服务",
createNewServiceDesc: "填写详细信息以创建要监控的新服务。",
};
// ServiceBasicFields.tsx
serviceName: "服务名称",
serviceNameDesc: "为你的服务输入一个描述性名称",
// ServiceConfigFields.tsx
checkInterval: "检查间隔",
seconds: "秒",
minute: "分钟",
minutes: "分钟",
hour: "小时",
hours: "小时",
custom: "自定义",
checkIntervalPlaceholder: "输入间隔时间(秒)",
backToPresets: "回到预设",
checkIntervalDesc: "多久检查一次服务状态",
checkIntervalDescCustom: "输入自定义间隔时间(以秒为单位,最小10秒)",
retryAttempts: "重试次数",
attempt: "次",
attempts: "次",
retryAttemptsDesc: "在标记为下线之前重试的次数",
// ServiceForm.tsx
updateService: "更新服务",
createService: "创建服务",
// ServiceNotificationFields.tsx
enableNotifications: "启用通知",
enableNotificationsDesc: "为本服务启用或禁用通知",
notificationChannels: "通知渠道",
notificationChannelsEnabledDesc: "为本服务选择通知渠道",
notificationChannelsDesc: "先启用通知以选择渠道",
notificationChannelsPlaceholder: "添加一个通知渠道",
alertTemplate: "警报模板",
alertTemplateLoading: "正在加载模板...",
alertTemplatePlaceholder: "选择一个警报模板",
alertTemplateEnabledDesc: "选择一个警报消息的模板",
alertTemplateDesc: "先启用通知才能选择模板",
// ServiceTypeField.tsx
serviceType: "服务类型",
serviceTypeHTTPDesc: "使用 HTTP/HTTPS 协议监控网站和 RESTAPI",
serviceTypePINGDesc: "使用 PING 协议监控主机可用性",
serviceTypeTCPDesc: "使用 TCP 协议监控 TCP 端口连接性",
serviceTypeDNSDesc: "监控 DNS 解析",
// ServiceRegionalFields.tsx
regionalMonitoring: "区域监控",
regionalMonitoringDesc: "将此服务分配给区域监控代理以进行分布式监控",
regionalAgents: "区域代理",
regionalAgentsLoading: "加载代理中...",
regionalAgentsAvailablePlaceholder: "选择额外的区域代理...",
regionalAgentsAllSelected: "已选择所有可用代理",
regionalAgentsNoAvailable: "无可用区域代理",
regionalAgentsNoOnlineAvailable: "无可用在线区域代理",
regionalAgentsNotFoundMessage: "未找到在线区域代理。服务将使用默认监控。",
regionalAgentsNotSelectedMessage: "未选择区域代理。服务将使用默认监控。",
// ServiceUrlField.tsx
targetDefault: "目标 URL/Host",
targetDNS: "域名",
targetHTTPDesc: "输入完整的 URL,包括协议(http:// 或 https://",
targetPINGDesc: "输入要 ping 的主机名或 IP 地址",
targetTCPDesc: "输入主机名或 IP 地址以进行 TCP 连接测试",
targetTCPPortDesc: "输入用于 TCP 连接测试的端口号",
targetDNSDesc: "输入要监控的 DNS 记录域名(A、AAAA、MX等)",
targetDefaultDesc: "输入要监控的目标 URL 或主机名",
targetDefaultPlaceholder: "输入 URL 或主机名",
};
+14 -7
View File
@@ -2,18 +2,18 @@
import { SettingsTranslations } from '../types/settings';
export const settingsTranslations: SettingsTranslations = {
// Tabs
// General Settings - Tabs
systemSettings: "系统设置",
mailSettings: "邮件设置",
// System Settings
// General Settings - System Settings
appName: "应用名称",
appURL: "应用 URL",
senderName: "发送者名称",
senderEmail: "发送者邮箱地址",
hideControls: "隐藏控件",
// Mail Settings
// General Settings - Mail Settings
smtpSettings: "SMTP 配置",
smtpEnabled: "启用 SMTP",
smtpHost: "SMTP 主机",
@@ -24,7 +24,7 @@ export const settingsTranslations: SettingsTranslations = {
enableTLS: "启用 TLS",
localName: "本地名称",
// Test Email
// General Settings - Test Email
testEmail: "测试邮箱",
sendTestEmail: "发送测试邮箱",
emailTemplate: "邮箱模板",
@@ -39,7 +39,7 @@ export const settingsTranslations: SettingsTranslations = {
enterEmailAddress: "输入收件人邮箱地址",
sending: "发送中...",
// Actions and status
// General Settings - Actions and status
save: "保存变更",
saving: "保存中...",
settingsUpdated: "设置已成功更新",
@@ -48,5 +48,12 @@ export const settingsTranslations: SettingsTranslations = {
testConnection: "测试连接",
testingConnection: "测试连接中...",
connectionSuccess: "连接成功",
connectionFailed: "连接失败"
};
connectionFailed: "连接失败",
// User Management
addUser: "添加用户",
permissionNotice: "权限问题:",
permissionNoticeAddUser: "作为管理员用户,您无权查看或修改系统及邮件设置。这些设置仅超级管理员可访问和修改。如需更改系统配置或邮件设置,请联系您的超级管理员。",
loadingSettings: "加载设置中...",
loadingSettingsError: "加载设置时出错",
};