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
@@ -3,12 +3,12 @@ import { Center, Text } from "@mantine/core";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
|
||||
export const WidgetEmptyState = () => {
|
||||
const t = useI18n();
|
||||
const t = useI18n("widget.common.error");
|
||||
|
||||
return (
|
||||
<Center h="100%" w="100%" p="sm">
|
||||
<Text c="dimmed" size="sm" ta="center">
|
||||
{t("widget.common.error.noData")}
|
||||
{t("noData")}
|
||||
</Text>
|
||||
</Center>
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { ActionIcon, Tooltip } from "@mantine/core";
|
||||
import { IconAlertTriangle } from "@tabler/icons-react";
|
||||
|
||||
import { useScopedI18n } from "@homarr/translation/client";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
|
||||
interface IntegrationResult {
|
||||
integrationId: string;
|
||||
@@ -16,7 +16,7 @@ interface IntegrationErrorIndicatorProps {
|
||||
}
|
||||
|
||||
export function IntegrationErrorIndicator({ results }: IntegrationErrorIndicatorProps) {
|
||||
const t = useScopedI18n("common");
|
||||
const t = useI18n("common");
|
||||
const failed = results.filter((result) => Boolean(result.error));
|
||||
if (failed.length === 0) return null;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { afterEach, describe, expect, test, vi } from "vitest";
|
||||
import { WidgetQueryErrorIndicator, WidgetQueryLoadingState } from "./query-state-indicator";
|
||||
|
||||
vi.mock("@homarr/translation/client", () => ({
|
||||
useScopedI18n: () => (key: string, values?: { widget?: string }) => {
|
||||
useI18n: () => (key: string, values?: { widget?: string }) => {
|
||||
if (key === "stale") return `Could not refresh ${values?.widget}; showing saved data`;
|
||||
if (key === "loading") return "Loading widget data";
|
||||
return key;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { ActionIcon, Center, Loader, Tooltip, VisuallyHidden } from "@mantine/core";
|
||||
import { IconAlertTriangle } from "@tabler/icons-react";
|
||||
|
||||
import { useScopedI18n } from "@homarr/translation/client";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
|
||||
interface WidgetQueryErrorIndicatorProps {
|
||||
error: unknown;
|
||||
@@ -12,7 +12,7 @@ interface WidgetQueryErrorIndicatorProps {
|
||||
|
||||
/** Localized warning for stale or optional-query failures. Never renders the raw error. */
|
||||
export function WidgetQueryErrorIndicator({ error, label }: WidgetQueryErrorIndicatorProps) {
|
||||
const t = useScopedI18n("common.widgetQuery");
|
||||
const t = useI18n("common.widgetQuery");
|
||||
if (!error) return null;
|
||||
|
||||
const accessibleLabel = t("stale", { widget: label });
|
||||
@@ -35,7 +35,7 @@ export function WidgetQueryErrorIndicator({ error, label }: WidgetQueryErrorIndi
|
||||
}
|
||||
|
||||
export function WidgetQueryLoadingState() {
|
||||
const t = useScopedI18n("common.widgetQuery");
|
||||
const t = useI18n("common.widgetQuery");
|
||||
return (
|
||||
<Center component="output" h="100%" w="100%" p="sm" aria-live="polite">
|
||||
<Loader size="sm" />
|
||||
|
||||
Reference in new issue
Block a user