fix: fix live page label i18n

This commit is contained in:
ZhaiSoul 2026-01-09 00:17:38 +08:00
parent af39ae8db9
commit a6cefb6890

View File

@ -16,7 +16,6 @@ import {
} from "@/types/live"; } from "@/types/live";
import { getIconForLabel } from "@/utils/iconUtil"; import { getIconForLabel } from "@/utils/iconUtil";
import Chip from "../indicators/Chip"; import Chip from "../indicators/Chip";
import { capitalizeFirstLetter } from "@/utils/stringUtil";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { TbExclamationCircle } from "react-icons/tb"; import { TbExclamationCircle } from "react-icons/tb";
import { TooltipPortal } from "@radix-ui/react-tooltip"; import { TooltipPortal } from "@radix-ui/react-tooltip";
@ -26,6 +25,8 @@ import { LuVideoOff } from "react-icons/lu";
import { Trans, useTranslation } from "react-i18next"; import { Trans, useTranslation } from "react-i18next";
import { useCameraFriendlyName } from "@/hooks/use-camera-friendly-name"; import { useCameraFriendlyName } from "@/hooks/use-camera-friendly-name";
import { ImageShadowOverlay } from "../overlay/ImageShadowOverlay"; import { ImageShadowOverlay } from "../overlay/ImageShadowOverlay";
import { getTranslatedLabel } from "@/utils/i18n";
import { formatList } from "@/utils/stringUtil";
type LivePlayerProps = { type LivePlayerProps = {
cameraRef?: (ref: HTMLDivElement | null) => void; cameraRef?: (ref: HTMLDivElement | null) => void;
@ -367,7 +368,8 @@ export default function LivePlayer({
</div> </div>
<TooltipPortal> <TooltipPortal>
<TooltipContent className="smart-capitalize"> <TooltipContent className="smart-capitalize">
{[ {formatList(
[
...new Set([ ...new Set([
...(objects || []).map(({ label, sub_label }) => ...(objects || []).map(({ label, sub_label }) =>
label.endsWith("verified") label.endsWith("verified")
@ -377,10 +379,11 @@ export default function LivePlayer({
]), ]),
] ]
.filter((label) => label?.includes("-verified") == false) .filter((label) => label?.includes("-verified") == false)
.map((label) => capitalizeFirstLetter(label)) .map((label) =>
.sort() getTranslatedLabel(label.replace("-verified", "")),
.join(", ") )
.replaceAll("-verified", "")} .sort(),
)}
</TooltipContent> </TooltipContent>
</TooltipPortal> </TooltipPortal>
</Tooltip> </Tooltip>