mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-02 19:02:31 +00:00
i18n: complete Slovak Monitor and CLI messages
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import enMessages from "../messages/en/common.json"
|
||||
|
||||
type Translate = (key: string, params?: Record<string, string | number>) => string
|
||||
|
||||
// Descriptions are live server metadata. Translate only exact known wording;
|
||||
// a newer script description must remain visible rather than become stale text.
|
||||
export function optimizationDescription(description: string, t: Translate): string {
|
||||
const entries = Object.entries(enMessages.settings.optimizations.toolDescriptions)
|
||||
const match = entries.find(([, english]) => english === description)
|
||||
return match ? t(`settings.optimizations.toolDescriptions.${match[0]}`) : description
|
||||
}
|
||||
|
||||
// Unknown tools retain the server's name until their key is translated.
|
||||
export function optimizationToolName(tool: string, fallback: string, t: Translate): string {
|
||||
return Object.prototype.hasOwnProperty.call(enMessages.settings.optimizations.toolNames, tool)
|
||||
? t(`settings.optimizations.toolNames.${tool}`)
|
||||
: fallback
|
||||
}
|
||||
Reference in New Issue
Block a user