Skip to content

Lightweight server monitoring with historical data, docker stats, and alerts.

fix(site): refresh interpolated translations on locale change (#2405)

spatiumstas6c47ca8eccb1
diff --git a/internal/site/src/components/add-system.tsx b/internal/site/src/components/add-system.tsx
index 9991ba25d..e3a8e1b0f 100644
--- a/internal/site/src/components/add-system.tsx
+++ b/internal/site/src/components/add-system.tsx
@@ -1,5 +1,4 @@
-import { t } from "@lingui/core/macro"
-import { Trans } from "@lingui/react/macro"
+import { Trans, useLingui } from "@lingui/react/macro"
import { useStore } from "@nanostores/react"
import { getPagePath } from "@nanostores/router"
import { ChevronDownIcon, ExternalLinkIcon } from "lucide-react"
@@ -65,6 +64,7 @@ let nextSystemToken: string | null = null
* @param {SystemRecord} [props.system] - Optional system record for editing an existing system.
*/
export const SystemDialog = ({ setOpen, system }: { setOpen: (open: boolean) => void; system?: SystemRecord }) => {
+ const { t } = useLingui()
const publicKey = useStore($publicKey)
const port = useRef<HTMLInputElement>(null)
const [hostValue, setHostValue] = useState(system?.host ?? "")
diff --git a/internal/site/src/components/navbar.tsx b/internal/site/src/components/navbar.tsx
index 28bf234c1..79b50c31a 100644
--- a/internal/site/src/components/navbar.tsx
+++ b/internal/site/src/components/navbar.tsx
@@ -1,4 +1,4 @@
-import { Trans } from "@lingui/react/macro"
+import { Trans, useLingui } from "@lingui/react/macro"
import { getPagePath } from "@nanostores/router"
import {
ContainerIcon,
@@ -42,6 +42,7 @@ const CommandPalette = lazy(() => import("./command-palette"))
const isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0
export default function Navbar() {
+ const { t } = useLingui()
const [addSystemDialogOpen, setAddSystemDialogOpen] = useState(false)
const [commandPaletteOpen, setCommandPaletteOpen] = useState(false)
diff --git a/internal/site/src/components/routes/settings/quiet-hours.tsx b/internal/site/src/components/routes/settings/quiet-hours.tsx
index a23f9dee8..8d45d5015 100644
--- a/internal/site/src/components/routes/settings/quiet-hours.tsx
+++ b/internal/site/src/components/routes/settings/quiet-hours.tsx
@@ -1,5 +1,4 @@
-import { t } from "@lingui/core/macro"
-import { Trans } from "@lingui/react/macro"
+import { Trans, useLingui } from "@lingui/react/macro"
import { useStore } from "@nanostores/react"
import {
MoreHorizontalIcon,
@@ -42,9 +41,9 @@ import { $systems } from "@/lib/stores"
import { formatShortDate } from "@/lib/utils"
import type { QuietHoursRecord, SystemRecord } from "@/types"
-const quietHoursTranslation = t`Quiet Hours`
-
export function QuietHours() {
+ const { t } = useLingui()
+ const quietHoursTranslation = t`Quiet Hours`
const [data, setData] = useState<QuietHoursRecord[]>([])
const [dialogOpen, setDialogOpen] = useState(false)
const [editingRecord, setEditingRecord] = useState<QuietHoursRecord | null>(null)
@@ -293,6 +292,8 @@ function QuietHoursDialog({
onClose: () => void
toast: ReturnType<typeof useToast>["toast"]
}) {
+ const { t } = useLingui()
+ const quietHoursTranslation = t`Quiet Hours`
const [selectedSystem, setSelectedSystem] = useState(editingRecord?.system || "")
const [isGlobal, setIsGlobal] = useState(!editingRecord?.system)
const [windowType, setWindowType] = useState<"one-time" | "daily">(editingRecord?.type || "one-time")