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
@@ -4,7 +4,7 @@ import { Stack, Text } from "@mantine/core";
|
||||
import { getQueryKey } from "@trpc/react-query";
|
||||
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import { useScopedI18n } from "@homarr/translation/client";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
|
||||
import type { WidgetComponentProps } from "../definition";
|
||||
import { useWidgetRuntimeQueries } from "../runtime-hooks";
|
||||
@@ -90,7 +90,7 @@ export default function UmamiWidget({
|
||||
}
|
||||
|
||||
function NoWebsiteConfigured() {
|
||||
const t = useScopedI18n("widget.umami");
|
||||
const t = useI18n("widget.umami");
|
||||
return (
|
||||
<Stack align="center" justify="center" h="100%">
|
||||
<Text c="dimmed" size="sm">
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Box, Group, ScrollArea, SimpleGrid, Stack, Text } from "@mantine/core";
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import { formatDuration } from "@homarr/common";
|
||||
import type { UmamiVisitorStats } from "@homarr/integrations/types";
|
||||
import { useCurrentIntlLocale, useScopedI18n } from "@homarr/translation/client";
|
||||
import { useCurrentIntlLocale, useI18n } from "@homarr/translation/client";
|
||||
|
||||
import { UmamiEventsContent } from "./umami-events-content";
|
||||
import { getUmamiLayout } from "./umami-layout";
|
||||
@@ -45,7 +45,7 @@ export function UmamiContent({
|
||||
height,
|
||||
displayMode,
|
||||
}: UmamiContentProps) {
|
||||
const t = useScopedI18n("widget.umami");
|
||||
const t = useI18n("widget.umami");
|
||||
const locale = useCurrentIntlLocale();
|
||||
const tickColor = "var(--mantine-color-dimmed)";
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { BarChart, LineChart } from "@mantine/charts";
|
||||
import { Box, Group, Stack, Text } from "@mantine/core";
|
||||
|
||||
import type { UmamiEventSeries } from "@homarr/integrations/types";
|
||||
import { useCurrentIntlLocale, useScopedI18n } from "@homarr/translation/client";
|
||||
import { useCurrentIntlLocale, useI18n } from "@homarr/translation/client";
|
||||
|
||||
import { EVENT_COLORS, formatXLabel } from "./umami-utils";
|
||||
|
||||
@@ -23,7 +23,7 @@ export function UmamiEventsContent({
|
||||
chartType,
|
||||
showXAxis,
|
||||
}: UmamiEventsContentProps) {
|
||||
const t = useScopedI18n("widget.umami");
|
||||
const t = useI18n("widget.umami");
|
||||
const locale = useCurrentIntlLocale();
|
||||
const tickColor = "var(--mantine-color-dimmed)";
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Group, ScrollArea, Stack, Text } from "@mantine/core";
|
||||
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import type { UmamiMetricItem } from "@homarr/integrations/types";
|
||||
import { useCurrentIntlLocale, useScopedI18n } from "@homarr/translation/client";
|
||||
import { useCurrentIntlLocale, useI18n } from "@homarr/translation/client";
|
||||
|
||||
import { umamiQueryOptions } from "./umami-utils";
|
||||
import { getUsableWidgetQueryData } from "../common/query-state";
|
||||
@@ -17,7 +17,7 @@ interface UmamiTopListProps {
|
||||
}
|
||||
|
||||
export function UmamiTopPagesContent({ integrationIds, websiteId, timeFrame, limit }: UmamiTopListProps) {
|
||||
const t = useScopedI18n("widget.umami");
|
||||
const t = useI18n("widget.umami");
|
||||
const data =
|
||||
getUsableWidgetQueryData(
|
||||
clientApi.widget.umami.getTopPages.useQuery(
|
||||
@@ -25,11 +25,11 @@ export function UmamiTopPagesContent({ integrationIds, websiteId, timeFrame, lim
|
||||
umamiQueryOptions,
|
||||
),
|
||||
) ?? [];
|
||||
return <UmamiTopList items={data} heading={t("option.viewMode.option.topPages")} emptyLabel={t("topPages.direct")} />;
|
||||
return <UmamiTopList items={data} heading={t("option.viewMode.option.topPages")} emptyLabel={t("top.direct")} />;
|
||||
}
|
||||
|
||||
export function UmamiTopReferrersContent({ integrationIds, websiteId, timeFrame, limit }: UmamiTopListProps) {
|
||||
const t = useScopedI18n("widget.umami");
|
||||
const t = useI18n("widget.umami");
|
||||
const data =
|
||||
getUsableWidgetQueryData(
|
||||
clientApi.widget.umami.getTopReferrers.useQuery(
|
||||
@@ -37,13 +37,7 @@ export function UmamiTopReferrersContent({ integrationIds, websiteId, timeFrame,
|
||||
umamiQueryOptions,
|
||||
),
|
||||
) ?? [];
|
||||
return (
|
||||
<UmamiTopList
|
||||
items={data}
|
||||
heading={t("option.viewMode.option.topReferrers")}
|
||||
emptyLabel={t("topReferrers.direct")}
|
||||
/>
|
||||
);
|
||||
return <UmamiTopList items={data} heading={t("option.viewMode.option.topReferrers")} emptyLabel={t("top.direct")} />;
|
||||
}
|
||||
|
||||
function UmamiTopList({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { useScopedI18n } from "@homarr/translation/client";
|
||||
import type { useI18n } from "@homarr/translation/client";
|
||||
|
||||
import { timeFrameValues } from "./index";
|
||||
|
||||
@@ -24,10 +24,7 @@ export function formatXLabel(timestamp: string, timeFrame: string, locale: strin
|
||||
|
||||
export type TimeFrame = (typeof timeFrameValues)[number];
|
||||
|
||||
export function formatTimeFrameLabel(
|
||||
timeFrame: TimeFrame,
|
||||
t: ReturnType<typeof useScopedI18n<"widget.umami">>,
|
||||
): string {
|
||||
export function formatTimeFrameLabel(timeFrame: TimeFrame, t: ReturnType<typeof useI18n<"widget.umami">>): string {
|
||||
if (timeFrameValues.includes(timeFrame)) {
|
||||
return t(`option.timeFrame.option.${timeFrame}`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user