refactor(ui): improve i18n

This commit is contained in:
Fu Diwei
2024-12-10 16:37:24 +08:00
parent a4eff0b408
commit 8fe0d342aa
76 changed files with 214 additions and 266 deletions

View File

@@ -29,13 +29,13 @@ const AccessList = () => {
},
{
key: "name",
title: t("common.text.name"),
title: t("access.props.name"),
ellipsis: true,
render: (_, record) => <>{record.name}</>,
},
{
key: "provider",
title: t("common.text.provider"),
title: t("access.props.provider"),
ellipsis: true,
render: (_, record) => {
return (
@@ -48,7 +48,7 @@ const AccessList = () => {
},
{
key: "createdAt",
title: t("common.text.created_at"),
title: t("access.props.created_at"),
ellipsis: true,
render: (_, record) => {
return dayjs(record.created!).format("YYYY-MM-DD HH:mm:ss");
@@ -56,7 +56,7 @@ const AccessList = () => {
},
{
key: "updatedAt",
title: t("common.text.updated_at"),
title: t("access.props.updated_at"),
ellipsis: true,
render: (_, record) => {
return dayjs(record.updated!).format("YYYY-MM-DD HH:mm:ss");

View File

@@ -77,10 +77,10 @@ const CertificateList = () => {
<Divider style={{ margin: 0 }} />
<Space className="justify-end w-full" style={{ padding: themeToken.paddingSM }}>
<Button size="small" disabled={!filters.state} onClick={handleResetClick}>
{t("common.reset")}
{t("common.button.reset")}
</Button>
<Button type="primary" size="small" onClick={handleConfirmClick}>
{t("common.confirm")}
{t("common.button.ok")}
</Button>
</Space>
</div>
@@ -113,7 +113,7 @@ const CertificateList = () => {
const workflowId = record.workflow;
return workflowId ? (
<Space className="max-w-full" direction="vertical" size={4}>
<Typography.Text>{t("common.text.workflow")}</Typography.Text>
<Typography.Text>{t("certificate.props.source.workflow")}</Typography.Text>
<Typography.Link
type="secondary"
ellipsis
@@ -131,7 +131,7 @@ const CertificateList = () => {
},
{
key: "createdAt",
title: t("common.text.created_at"),
title: t("certificate.props.created_at"),
ellipsis: true,
render: (_, record) => {
return dayjs(record.created!).format("YYYY-MM-DD HH:mm:ss");
@@ -139,7 +139,7 @@ const CertificateList = () => {
},
{
key: "updatedAt",
title: t("common.text.updated_at"),
title: t("certificate.props.updated_at"),
ellipsis: true,
render: (_, record) => {
return dayjs(record.updated!).format("YYYY-MM-DD HH:mm:ss");

View File

@@ -115,7 +115,7 @@ const Dashboard = () => {
<Divider />
<div>TODO: 最近执行的工作流 LatestWorkflowRun</div>
<div>TODO: {t("dashboard.latest_workflow_run")}</div>
</>
);
};

View File

@@ -84,10 +84,10 @@ const Account = () => {
<div className="flex justify-end">
{changed ? (
<Button type="submit">{t("common.update")}</Button>
<Button type="submit">{t("common.button.save")}</Button>
) : (
<Button type="submit" disabled variant={"secondary"}>
{t("common.update")}
{t("common.button.save")}
</Button>
)}
</div>

View File

@@ -124,7 +124,7 @@ const Password = () => {
)}
/>
<div className="flex justify-end">
<Button type="submit">{t("common.update")}</Button>
<Button type="submit">{t("common.button.save")}</Button>
</div>
</form>
</Form>

View File

@@ -80,13 +80,13 @@ const SSLProvider = () => {
const resp = await update({ ...data });
setConfig(resp);
toast({
title: t("common.update.succeeded.message"),
description: t("common.update.succeeded.message"),
title: t("common.text.operation_succeeded"),
description: t("common.text.operation_succeeded"),
});
} catch (e) {
const message = getErrMsg(e);
toast({
title: t("common.update.failed.message"),
title: t("common.text.operation_failed"),
description: message,
variant: "destructive",
});
@@ -222,7 +222,7 @@ const SSLProviderLetsEncryptForm = () => {
<FormMessage />
<div className="flex justify-end">
<Button type="submit">{t("common.update")}</Button>
<Button type="submit">{t("common.button.save")}</Button>
</div>
</form>
</Form>
@@ -328,7 +328,7 @@ const SSLProviderZeroSSLForm = () => {
<FormMessage />
<div className="flex justify-end">
<Button type="submit">{t("common.update")}</Button>
<Button type="submit">{t("common.button.save")}</Button>
</div>
</form>
</Form>
@@ -435,7 +435,7 @@ const SSLProviderGtsForm = () => {
<FormMessage />
<div className="flex justify-end">
<Button type="submit">{t("common.update")}</Button>
<Button type="submit">{t("common.button.save")}</Button>
</div>
</form>
</Form>

View File

@@ -49,7 +49,7 @@ const WorkflowList = () => {
},
{
key: "name",
title: t("common.text.name"),
title: t("workflow.props.name"),
ellipsis: true,
render: (_, record) => (
<Space className="max-w-full" direction="vertical" size={4}>
@@ -62,7 +62,7 @@ const WorkflowList = () => {
},
{
key: "type",
title: t("workflow.props.executionMethod"),
title: t("workflow.props.execution_method"),
ellipsis: true,
render: (_, record) => {
const method = record.type;
@@ -120,10 +120,10 @@ const WorkflowList = () => {
<Divider style={{ margin: 0 }} />
<Space className="justify-end w-full" style={{ padding: themeToken.paddingSM }}>
<Button size="small" disabled={!filters.state} onClick={handleResetClick}>
{t("common.reset")}
{t("common.button.reset")}
</Button>
<Button type="primary" size="small" onClick={handleConfirmClick}>
{t("common.confirm")}
{t("common.button.ok")}
</Button>
</Space>
</div>
@@ -152,7 +152,7 @@ const WorkflowList = () => {
},
{
key: "createdAt",
title: t("common.text.created_at"),
title: t("workflow.props.created_at"),
ellipsis: true,
render: (_, record) => {
return dayjs(record.created!).format("YYYY-MM-DD HH:mm:ss");
@@ -160,7 +160,7 @@ const WorkflowList = () => {
},
{
key: "updatedAt",
title: t("common.text.updated_at"),
title: t("workflow.props.updated_at"),
ellipsis: true,
render: (_, record) => {
return dayjs(record.updated!).format("YYYY-MM-DD HH:mm:ss");
@@ -173,7 +173,7 @@ const WorkflowList = () => {
width: 120,
render: (_, record) => (
<Space size={0}>
<Tooltip title={t("common.edit")}>
<Tooltip title={t("workflow.action.edit")}>
<Button
type="link"
icon={<PencilIcon size={16} />}
@@ -182,7 +182,7 @@ const WorkflowList = () => {
}}
/>
</Tooltip>
<Tooltip title={t("common.delete")}>
<Tooltip title={t("workflow.action.delete")}>
<Button
type="link"
danger={true}
@@ -261,8 +261,8 @@ const WorkflowList = () => {
const handleDeleteClick = (workflow: WorkflowType) => {
modalApi.confirm({
title: t("workflow.action.delete.alert.title"),
content: t("workflow.action.delete.alert.content"),
title: t("workflow.action.delete"),
content: t("workflow.action.delete.confirm"),
onOk: async () => {
try {
const resp = await removeWorkflow(workflow);