fix(i18n): i18n translation called multiple times incorrectly (#295)

* fix(i18n): i18n translation called multiple times incorrectly

* Update ShareDialog.tsx

* Update Home.tsx

* Update GroupSelectionInput.tsx
This commit is contained in:
Darren Yu 2025-08-21 09:52:43 +08:00 committed by GitHub
parent 8e56ad86ed
commit a612a8e16e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 12 additions and 10 deletions

View File

@ -62,6 +62,7 @@
"shareLinks": "Share links",
"totalBlobs": "Blobs",
"homepage": "Homepage",
"github": "GitHub",
"documents": "Documents",
"discordCommunity": "Discord community",
"telegram": "Telegram group",

View File

@ -62,6 +62,7 @@
"shareLinks": "共有リンク",
"totalBlobs": "ファイルBlob",
"homepage": "ホーム",
"github": "GitHub",
"documents": "ドキュメント",
"discordCommunity": "Discordコミュニティ",
"telegram": "Telegramグループ",

View File

@ -62,6 +62,7 @@
"shareLinks": "分享链接",
"totalBlobs": "文件 Blob",
"homepage": "主页",
"github": "GitHub",
"documents": "文档",
"discordCommunity": "Discord 社群",
"telegram": "Telegram 社群",

View File

@ -62,6 +62,7 @@
"shareLinks": "分享連結",
"totalBlobs": "檔案 Blob",
"homepage": "主頁",
"github": "GitHub",
"documents": "檔案",
"discordCommunity": "Discord 社群",
"telegram": "Telegram 社群",

View File

@ -1,7 +1,6 @@
import { ListItemText } from "@mui/material";
import FormControl from "@mui/material/FormControl";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { getGroupList } from "../../../api/api";
import { GroupEnt } from "../../../api/dashboard";
import { useAppDispatch } from "../../../redux/hooks";
@ -29,7 +28,6 @@ const GroupSelectionInput = ({
fullWidth,
required,
}: GroupSelectionInputProps) => {
const { t } = useTranslation("dashboard");
const dispatch = useAppDispatch();
const [loading, setLoading] = useState(true);
const [groups, setGroups] = useState<GroupEnt[]>([]);
@ -81,7 +79,7 @@ const GroupSelectionInput = ({
{emptyValue !== undefined && emptyText && (
<SquareMenuItem value={emptyValue}>
<ListItemText
primary={<em>{t(emptyText)}</em>}
primary={<em>{emptyText}</em>}
slotProps={{
primary: { variant: "body2" },
}}

View File

@ -97,7 +97,7 @@ const Home = () => {
existingUrls={summary?.site_urls ?? []}
/>
<Container maxWidth="xl">
<PageHeader title={t("dashboard:nav.summary")} />
<PageHeader title={t("nav.summary")} />
<Grid container spacing={3}>
<Grid alignContent={"stretch"} item xs={12} md={8} lg={9}>
<StyledPaper>
@ -330,7 +330,7 @@ const Home = () => {
<ListItemIcon>
<GitHub />
</ListItemIcon>
<ListItemText primary={t("GitHub")} />
<ListItemText primary={t("summary.github")} />
<StyledListItemIcon>
<OpenFilled />
</StyledListItemIcon>
@ -362,7 +362,7 @@ const Home = () => {
<OpenFilled />
</StyledListItemIcon>
</ListItemButton>
<ListItemButton onClick={() => window.open("https://github.com/cloudreve/Cloudreve/discussions")}>
<ListItemButton onClick={() => window.open("https://github.com/cloudreve/cloudreve/discussions")}>
<ListItemIcon>
<CommentMultiple />
</ListItemIcon>
@ -391,7 +391,7 @@ const Home = () => {
<Divider sx={{ mb: 2, mt: 1 }} />
<Giscus
id="comments"
repo="cloudreve/Cloudreve"
repo="cloudreve/cloudreve"
repoId="MDEwOlJlcG9zaXRvcnkxMjAxNTYwNzY="
mapping={"number"}
term={i18next.language == "zh-CN" ? "2170" : "2169"}

View File

@ -93,7 +93,7 @@ const DraggableDialog = (props: DraggableDialogProps) => {
<Stack direction={"row"} spacing={1}>
{props.showCancel && (
<Button disabled={props.loading} onClick={onClose}>
{t(props.cancelText ?? "common:cancel")}
{props.cancelText ?? t("common:cancel")}
</Button>
)}
{!props.hideOk && (
@ -104,7 +104,7 @@ const DraggableDialog = (props: DraggableDialogProps) => {
onClick={props.onAccept}
color="primary"
>
<span>{t(props.okText ?? "common:ok")}</span>
<span>{props.okText ?? t("common:ok")}</span>
</LoadingButton>
)}
</Stack>

View File

@ -162,7 +162,7 @@ const ShareDialog = () => {
fullWidth: true,
maxWidth: "xs",
}}
cancelText={shareLink ? "common:close" : undefined}
cancelText={shareLink ? t("common:close") : undefined}
secondaryAction={
shareLink
? // @ts-ignore