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

This commit is contained in:
spatiumstas
2026-09-29 19:57:57 +03:00
committed by GitHub
parent 3281055d95
commit 6c47ca8ecc
3 changed files with 9 additions and 7 deletions

View File

@@ -1,5 +1,4 @@
import { t } from "@lingui/core/macro" import { Trans, useLingui } from "@lingui/react/macro"
import { Trans } from "@lingui/react/macro"
import { useStore } from "@nanostores/react" import { useStore } from "@nanostores/react"
import { getPagePath } from "@nanostores/router" import { getPagePath } from "@nanostores/router"
import { ChevronDownIcon, ExternalLinkIcon } from "lucide-react" 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. * @param {SystemRecord} [props.system] - Optional system record for editing an existing system.
*/ */
export const SystemDialog = ({ setOpen, system }: { setOpen: (open: boolean) => void; system?: SystemRecord }) => { export const SystemDialog = ({ setOpen, system }: { setOpen: (open: boolean) => void; system?: SystemRecord }) => {
const { t } = useLingui()
const publicKey = useStore($publicKey) const publicKey = useStore($publicKey)
const port = useRef<HTMLInputElement>(null) const port = useRef<HTMLInputElement>(null)
const [hostValue, setHostValue] = useState(system?.host ?? "") const [hostValue, setHostValue] = useState(system?.host ?? "")

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 { getPagePath } from "@nanostores/router"
import { import {
ContainerIcon, ContainerIcon,
@@ -42,6 +42,7 @@ const CommandPalette = lazy(() => import("./command-palette"))
const isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0 const isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0
export default function Navbar() { export default function Navbar() {
const { t } = useLingui()
const [addSystemDialogOpen, setAddSystemDialogOpen] = useState(false) const [addSystemDialogOpen, setAddSystemDialogOpen] = useState(false)
const [commandPaletteOpen, setCommandPaletteOpen] = useState(false) const [commandPaletteOpen, setCommandPaletteOpen] = useState(false)

View File

@@ -1,5 +1,4 @@
import { t } from "@lingui/core/macro" import { Trans, useLingui } from "@lingui/react/macro"
import { Trans } from "@lingui/react/macro"
import { useStore } from "@nanostores/react" import { useStore } from "@nanostores/react"
import { import {
MoreHorizontalIcon, MoreHorizontalIcon,
@@ -42,9 +41,9 @@ import { $systems } from "@/lib/stores"
import { formatShortDate } from "@/lib/utils" import { formatShortDate } from "@/lib/utils"
import type { QuietHoursRecord, SystemRecord } from "@/types" import type { QuietHoursRecord, SystemRecord } from "@/types"
const quietHoursTranslation = t`Quiet Hours`
export function QuietHours() { export function QuietHours() {
const { t } = useLingui()
const quietHoursTranslation = t`Quiet Hours`
const [data, setData] = useState<QuietHoursRecord[]>([]) const [data, setData] = useState<QuietHoursRecord[]>([])
const [dialogOpen, setDialogOpen] = useState(false) const [dialogOpen, setDialogOpen] = useState(false)
const [editingRecord, setEditingRecord] = useState<QuietHoursRecord | null>(null) const [editingRecord, setEditingRecord] = useState<QuietHoursRecord | null>(null)
@@ -293,6 +292,8 @@ function QuietHoursDialog({
onClose: () => void onClose: () => void
toast: ReturnType<typeof useToast>["toast"] toast: ReturnType<typeof useToast>["toast"]
}) { }) {
const { t } = useLingui()
const quietHoursTranslation = t`Quiet Hours`
const [selectedSystem, setSelectedSystem] = useState(editingRecord?.system || "") const [selectedSystem, setSelectedSystem] = useState(editingRecord?.system || "")
const [isGlobal, setIsGlobal] = useState(!editingRecord?.system) const [isGlobal, setIsGlobal] = useState(!editingRecord?.system)
const [windowType, setWindowType] = useState<"one-time" | "daily">(editingRecord?.type || "one-time") const [windowType, setWindowType] = useState<"one-time" | "daily">(editingRecord?.type || "one-time")