mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-02 10:52:22 +00:00
i18n: translate optimization names in source viewer headings
This commit is contained in:
@@ -19,7 +19,7 @@ import { SUPPORTED_LANGUAGES, useI18n } from "../lib/i18n/provider"
|
||||
import { useIsPbs } from "../lib/use-platform"
|
||||
import type { LanguageCode } from "../lib/i18n/languages"
|
||||
import { NavTabOrderCard } from "./nav-tab-order-card"
|
||||
import { optimizationSourceError, type OptimizationSourceError, type OptimizationSourceResponse } from "../lib/optimization-source-errors"
|
||||
import { optimizationSourceError, optimizationSourceName, type OptimizationSourceError, type OptimizationSourceResponse } from "../lib/optimization-source-errors"
|
||||
|
||||
// GitHub Dark color palette for bash syntax highlighting
|
||||
const BASH_KEYWORDS = new Set([
|
||||
@@ -355,6 +355,7 @@ export function Settings() {
|
||||
open: boolean
|
||||
loading: boolean
|
||||
toolName: string
|
||||
toolKey: string
|
||||
version: string
|
||||
availableVersion: string
|
||||
functionName: string
|
||||
@@ -362,7 +363,7 @@ export function Settings() {
|
||||
script: string
|
||||
error: OptimizationSourceError | null
|
||||
deprecated: boolean
|
||||
}>({ open: false, loading: false, toolName: '', version: '', availableVersion: '', functionName: '', source: '', script: '', error: null, deprecated: false })
|
||||
}>({ open: false, loading: false, toolName: '', toolKey: '', version: '', availableVersion: '', functionName: '', source: '', script: '', error: null, deprecated: false })
|
||||
const [codeCopied, setCodeCopied] = useState(false)
|
||||
const codeRequest = useRef(0)
|
||||
const closeCodeModal = () => {
|
||||
@@ -685,6 +686,7 @@ export function Settings() {
|
||||
open: true,
|
||||
loading: true,
|
||||
toolName: tool.name,
|
||||
toolKey: tool.key,
|
||||
version: tool.version || '1.0',
|
||||
availableVersion: tool.available_version || tool.version || '1.0',
|
||||
functionName: '',
|
||||
@@ -2182,7 +2184,7 @@ export function Settings() {
|
||||
className="relative bg-card border border-border rounded-xl shadow-2xl w-full max-w-4xl max-h-[85vh] flex flex-col"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t("settings.optimizations.sourceDialogTitle", { name: codeModal.toolName })}
|
||||
aria-label={t("settings.optimizations.sourceDialogTitle", { name: optimizationSourceName(codeModal.toolKey, codeModal.toolName, t) })}
|
||||
onClick={e => e.stopPropagation()}
|
||||
>
|
||||
{/* Header */}
|
||||
@@ -2191,7 +2193,7 @@ export function Settings() {
|
||||
<Code className={`h-5 w-5 flex-shrink-0 ${codeModal.deprecated ? 'text-amber-500' : 'text-orange-500'}`} />
|
||||
<div className="min-w-0">
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<h3 className="text-sm font-semibold truncate">{codeModal.toolName}</h3>
|
||||
<h3 className="text-sm font-semibold truncate">{optimizationSourceName(codeModal.toolKey, codeModal.toolName, t)}</h3>
|
||||
{codeModal.deprecated && (
|
||||
<span className="text-[9px] uppercase tracking-wider text-amber-500 bg-amber-500/10 border border-amber-500/30 px-1.5 py-0.5 rounded flex-shrink-0">
|
||||
{t("settings.optimizations.legacy")}
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
type Translate = (key: string, params?: Record<string, string | number>) => string
|
||||
|
||||
const SOURCE_TOOLS = new Set([
|
||||
"subscription_banner", "time_sync", "apt_languages", "journald", "logrotate",
|
||||
"system_limits", "memory_settings", "zram_swap", "kernel_panic", "apt_ipv4",
|
||||
"kexec", "rpc", "motd", "system_utils", "network_optimization", "bashrc_custom",
|
||||
"figurine", "fastfetch", "log2ram", "zfs_autotrim", "amd_fixes", "persistent_network",
|
||||
"vfio_iommu", "lvm_repair", "repo_cleanup", "proxmox_repos", "entropy",
|
||||
])
|
||||
|
||||
export function optimizationSourceName(tool: string, fallback: string, t: Translate): string {
|
||||
return SOURCE_TOOLS.has(tool) ? t(`settings.optimizations.sourceToolNames.${tool}`) : fallback
|
||||
}
|
||||
|
||||
export interface OptimizationSourceError {
|
||||
kind: "unavailable" | "loadFailed"
|
||||
detail?: string
|
||||
|
||||
@@ -2375,6 +2375,35 @@
|
||||
"sourceFunctionMissing": "The function was not found in the available scripts.",
|
||||
"sourceUnknownTool": "Unknown tool: {tool}",
|
||||
"sourceNoMapping": "No function is assigned to the tool {tool}.",
|
||||
"sourceToolNames": {
|
||||
"subscription_banner": "Subscription Banner Removal",
|
||||
"time_sync": "Time Synchronization",
|
||||
"apt_languages": "APT Language Skip",
|
||||
"journald": "Journald Optimization",
|
||||
"logrotate": "Logrotate Optimization",
|
||||
"system_limits": "System Limits Increase",
|
||||
"memory_settings": "Memory Settings Optimization",
|
||||
"zram_swap": "ZRAM Swap Profile",
|
||||
"kernel_panic": "Kernel Panic Configuration",
|
||||
"apt_ipv4": "APT IPv4 Force",
|
||||
"kexec": "kexec for quick reboots",
|
||||
"rpc": "RPC / rpcbind Disable",
|
||||
"motd": "Custom MOTD Banner",
|
||||
"system_utils": "System Utilities",
|
||||
"network_optimization": "Network Optimizations",
|
||||
"bashrc_custom": "Bashrc Customization",
|
||||
"figurine": "Figurine",
|
||||
"fastfetch": "Fastfetch",
|
||||
"log2ram": "Log2ram (SSD Protection)",
|
||||
"zfs_autotrim": "ZFS Autotrim",
|
||||
"amd_fixes": "AMD CPU (Ryzen/EPYC) fixes",
|
||||
"persistent_network": "Setting persistent network interfaces",
|
||||
"vfio_iommu": "VFIO/IOMMU Passthrough",
|
||||
"lvm_repair": "LVM PV Headers Repair",
|
||||
"repo_cleanup": "Repository Cleanup",
|
||||
"proxmox_repos": "Proxmox APT Repositories",
|
||||
"entropy": "Entropy Generation (haveged)"
|
||||
},
|
||||
"legacy": "legacy",
|
||||
"updateToolTitle": "Update {name} to v{version}",
|
||||
"availableUpdates": "Available updates",
|
||||
|
||||
@@ -2300,6 +2300,35 @@
|
||||
"sourceFunctionMissing": "Funkcia sa nenašla v dostupných skriptoch.",
|
||||
"sourceUnknownTool": "Neznámy nástroj: {tool}",
|
||||
"sourceNoMapping": "K nástroju {tool} nie je priradená funkcia.",
|
||||
"sourceToolNames": {
|
||||
"subscription_banner": "Odstránenie upozornenia na predplatné",
|
||||
"time_sync": "Synchronizácia času",
|
||||
"apt_languages": "Vynechanie jazykových balíkov APT",
|
||||
"journald": "Optimalizácia journald",
|
||||
"logrotate": "Optimalizácia logrotate",
|
||||
"system_limits": "Zvýšenie systémových limitov",
|
||||
"memory_settings": "Optimalizácia nastavení pamäte",
|
||||
"zram_swap": "Profil swapu ZRAM",
|
||||
"kernel_panic": "Nastavenie správania pri páde jadra",
|
||||
"apt_ipv4": "Vynútenie IPv4 pre APT",
|
||||
"kexec": "Rýchly reštart cez kexec",
|
||||
"rpc": "Vypnutie RPC / rpcbind",
|
||||
"motd": "Vlastná uvítacia správa MOTD",
|
||||
"system_utils": "Systémové nástroje",
|
||||
"network_optimization": "Optimalizácia siete",
|
||||
"bashrc_custom": "Prispôsobenie bashrc",
|
||||
"figurine": "Figurine",
|
||||
"fastfetch": "Fastfetch",
|
||||
"log2ram": "Log2ram (ochrana SSD)",
|
||||
"zfs_autotrim": "ZFS Autotrim",
|
||||
"amd_fixes": "Opravy pre procesory AMD (Ryzen/EPYC)",
|
||||
"persistent_network": "Trvalé názvy sieťových rozhraní",
|
||||
"vfio_iommu": "Priame priradenie zariadení (VFIO/IOMMU)",
|
||||
"lvm_repair": "Oprava hlavičiek fyzických zväzkov LVM",
|
||||
"repo_cleanup": "Vyčistenie repozitárov",
|
||||
"proxmox_repos": "Repozitáre APT pre Proxmox",
|
||||
"entropy": "Generovanie entropie (haveged)"
|
||||
},
|
||||
"legacy": "staršie",
|
||||
"updateToolTitle": "Aktualizovať {name} na v{version}",
|
||||
"availableUpdates": "Dostupné aktualizácie",
|
||||
|
||||
Reference in New Issue
Block a user