feat: 增加管理端多语言与多模块界面国际化支持
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { Plus, RefreshCw, Rocket, Save } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
@@ -23,14 +24,16 @@ export function ConfigVersionActions({
|
||||
loadingList = false,
|
||||
loadingDetail = false,
|
||||
saving = false,
|
||||
publishLabel = "启用为当前版本",
|
||||
publishLabel,
|
||||
onRefresh,
|
||||
onNewDraft,
|
||||
onSaveDraft,
|
||||
onPublish,
|
||||
className,
|
||||
}: ConfigVersionActionsProps) {
|
||||
const { t } = useTranslation("config");
|
||||
const draftActionBusy = saving || loadingDetail;
|
||||
const resolvedPublishLabel = publishLabel ?? t("versionActions.publishCurrent");
|
||||
|
||||
return (
|
||||
<div className={cn("flex flex-wrap items-center gap-2 lg:justify-end", className)}>
|
||||
@@ -42,7 +45,7 @@ export function ConfigVersionActions({
|
||||
onClick={onRefresh}
|
||||
>
|
||||
<RefreshCw className={loadingList ? "size-4 animate-spin" : "size-4"} aria-hidden />
|
||||
{loadingList ? "刷新中" : "刷新版本"}
|
||||
{loadingList ? t("versionActions.refreshing") : t("versionActions.refresh")}
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
@@ -51,7 +54,7 @@ export function ConfigVersionActions({
|
||||
onClick={onNewDraft}
|
||||
>
|
||||
<Plus className="size-4" aria-hidden />
|
||||
新建草稿
|
||||
{t("versionActions.newDraft")}
|
||||
</Button>
|
||||
{isDraft ? (
|
||||
<>
|
||||
@@ -63,7 +66,7 @@ export function ConfigVersionActions({
|
||||
onClick={onSaveDraft}
|
||||
>
|
||||
<Save className="size-4" aria-hidden />
|
||||
保存草稿
|
||||
{t("versionActions.saveDraft")}
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
@@ -72,7 +75,7 @@ export function ConfigVersionActions({
|
||||
onClick={onPublish}
|
||||
>
|
||||
<Rocket className="size-4" aria-hidden />
|
||||
{publishLabel}
|
||||
{resolvedPublishLabel}
|
||||
</Button>
|
||||
</>
|
||||
) : null}
|
||||
|
||||
Reference in New Issue
Block a user