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,20 +368,22 @@ export default function LivePlayer({
</div> </div>
<TooltipPortal> <TooltipPortal>
<TooltipContent className="smart-capitalize"> <TooltipContent className="smart-capitalize">
{[ {formatList(
...new Set([ [
...(objects || []).map(({ label, sub_label }) => ...new Set([
label.endsWith("verified") ...(objects || []).map(({ label, sub_label }) =>
? sub_label label.endsWith("verified")
: label.replaceAll("_", " "), ? sub_label
), : label.replaceAll("_", " "),
]), ),
] ]),
.filter((label) => label?.includes("-verified") == false) ]
.map((label) => capitalizeFirstLetter(label)) .filter((label) => label?.includes("-verified") == false)
.sort() .map((label) =>
.join(", ") getTranslatedLabel(label.replace("-verified", "")),
.replaceAll("-verified", "")} )
.sort(),
)}
</TooltipContent> </TooltipContent>
</TooltipPortal> </TooltipPortal>
</Tooltip> </Tooltip>