refactor: consolidate English translations (#6640)
This commit is contained in:
1 parent
81aa704537
commit
9e14a07e64
449 files changed
+3515
-3922
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { IconAlignLeft, IconEyeOff, IconGraphFilled, IconListDetails, IconPhoto } from "@tabler/icons-react";
|
||||
|
||||
import { objectEntries } from "@homarr/common";
|
||||
import { invariantTechnicalLabels } from "@homarr/definitions";
|
||||
|
||||
import { createWidgetDefinition } from "../definition";
|
||||
import { optionsBuilder } from "../options";
|
||||
@@ -12,6 +13,12 @@ const labelDisplayModeOptions = {
|
||||
hidden: IconEyeOff,
|
||||
} as const;
|
||||
|
||||
const getChartOptionLabel = (key: "cpu" | "memory" | "gpu" | "network", t: (key: never) => string) => {
|
||||
if (key === "cpu") return invariantTechnicalLabels.cpu;
|
||||
if (key === "gpu") return invariantTechnicalLabels.gpu;
|
||||
return t(`widget.systemResources.option.visibleCharts.option.${key}` as never);
|
||||
};
|
||||
|
||||
export const { definition, componentLoader } = createWidgetDefinition("systemResources", {
|
||||
icon: IconGraphFilled,
|
||||
supportsAdvancedFocus: true,
|
||||
@@ -24,7 +31,7 @@ export const { definition, componentLoader } = createWidgetDefinition("systemRes
|
||||
visibleCharts: factory.multiSelect({
|
||||
options: (["cpu", "memory", "gpu", "network"] as const).map((key) => ({
|
||||
value: key,
|
||||
label: (t) => t(`widget.systemResources.option.visibleCharts.option.${key}`),
|
||||
label: (t) => getChartOptionLabel(key, t),
|
||||
})),
|
||||
defaultValue: ["cpu", "memory", "network"],
|
||||
withDescription: true,
|
||||
|
||||
Reference in new issue
Block a user