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

This commit is contained in:
spatiumstas
2026-09-29 12:57:57 -04:00
committed by GitHub
parent 3281055d95
commit 6c47ca8ecc
3 changed files with 9 additions and 7 deletions
+2 -2
View File
@@ -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 ?? "")
+2 -1
View File
@@ -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)
@@ -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")