From ce078bb132d24b2ad664b207249eb9f49d12c5e3 Mon Sep 17 00:00:00 2001 From: Takeshi Kimata <117462761+kimatata@users.noreply.github.com> Date: Sun, 5 May 2024 18:39:05 +0900 Subject: [PATCH] Apply i18n --- frontend/config/selection.ts | 12 +++---- frontend/messages/en.json | 25 +++++++++++++ frontend/messages/ja.json | 25 +++++++++++++ .../projects/[projectId]/runs/RunsPage.tsx | 9 +++-- .../projects/[projectId]/runs/RunsTable.tsx | 24 +++++++------ .../[projectId]/runs/[runId]/RunEditor.tsx | 36 ++++++++++--------- .../[projectId]/runs/[runId]/page.tsx | 16 ++++++++- .../projects/[projectId]/runs/page.tsx | 20 ++++++++++- frontend/types/run.ts | 29 ++++++++++++++- 9 files changed, 157 insertions(+), 39 deletions(-) diff --git a/frontend/config/selection.ts b/frontend/config/selection.ts index 74b794d..d812141 100644 --- a/frontend/config/selection.ts +++ b/frontend/config/selection.ts @@ -31,12 +31,12 @@ const automationStatus = [ const templates = [{ uid: "text" }, { uid: "step" }]; const testRunStatus = [ - { name: "New", uid: "new" }, - { name: "In progress", uid: "in-progress" }, - { name: "Under review", uid: "under-review" }, - { name: "Rejected", uid: "rejected" }, - { name: "Done", uid: "done" }, - { name: "Closed", uid: "closed" }, + { uid: "new" }, + { uid: "inProgress" }, + { uid: "underReview" }, + { uid: "rejected" }, + { uid: "done" }, + { uid: "closed" }, ]; const testRunCaseStatus = [ diff --git a/frontend/messages/en.json b/frontend/messages/en.json index 3444f9b..7777db4 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -100,8 +100,31 @@ "max_file_size": "Max. file size" }, "Runs": { + "runs": "Test Runs", + "id": "ID", + "name": "Name", + "description": "Description", + "last_update": "Last update", + "actions": "Actions", + "new_run": "New Run", + "delete_run": "Delete Run", + "no_runs_found": "No runs found" + }, + "Run": { + "back_to_runs": "Back to test runs", + "updating": "Updating...", + "update": "Update", + "progress": "Progress", "id": "ID", "title": "Title", + "please_enter": "Please enter run name", + "description": "Description", + "new": "New", + "inProgress": "In progress", + "underReview": "Under review", + "rejected": "Rejected", + "done": "Done", + "closed": "Closed", "priority": "Priority", "status": "Status", "actions": "Actions", @@ -114,6 +137,8 @@ "failed": "Failed", "retest": "Retest", "skipped": "Skipped", + "select_test_case": "Select test cases", + "test_case_selection": "Test case selection", "include_in_run": "Include in run", "exclude_from_run": "Exclude from run", "no_cases_found": "No cases found" diff --git a/frontend/messages/ja.json b/frontend/messages/ja.json index ec182b1..89930be 100644 --- a/frontend/messages/ja.json +++ b/frontend/messages/ja.json @@ -100,8 +100,31 @@ "max_file_size": "最大ファイルサイズ" }, "Runs": { + "runs": "テストラン", + "id": "ID", + "name": "名前", + "description": "詳細", + "last_update": "最終更新", + "actions": "アクション", + "new_run": "新規テストラン", + "delete_run": "テストランを削除", + "no_runs_found": "テストランがありません" + }, + "Run": { + "back_to_runs": "テストラン一覧に戻る", + "updating": "更新中...", + "update": "更新", + "progress": "進捗", "id": "ID", "title": "タイトル", + "description": "詳細", + "new": "新規", + "inProgress": "進行中", + "underReview": "レビュー中", + "rejected": "却下", + "done": "完了", + "closed": "クローズ", + "please_enter": "タイトルを入力してください", "priority": "優先度", "status": "ステータス", "actions": "アクション", @@ -114,6 +137,8 @@ "failed": "失敗", "retest": "再テスト", "skipped": "スキップ", + "select_test_case": "テストケースを選択", + "test_case_selection": "テストケース選択", "include_in_run": "テストランに含める", "exclude_from_run": "テストランから除外する", "no_cases_found": "テストケースが見つかりません" diff --git a/frontend/src/app/[locale]/projects/[projectId]/runs/RunsPage.tsx b/frontend/src/app/[locale]/projects/[projectId]/runs/RunsPage.tsx index ca761fe..e49f6a0 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/runs/RunsPage.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/runs/RunsPage.tsx @@ -4,13 +4,15 @@ import { Button } from "@nextui-org/react"; import { Plus } from "lucide-react"; import RunsTable from "./RunsTable"; import { fetchRuns, createRun, deleteRun } from "./runsControl"; +import { RunsMessages } from "@/types/run"; type Props = { projectId: string; locale: string; + messages: RunsMessages; }; -export default function RunsPage({ projectId, locale }: Props) { +export default function RunsPage({ projectId, locale, messages }: Props) { const [runs, setRuns] = useState([]); useEffect(() => { @@ -50,7 +52,7 @@ export default function RunsPage({ projectId, locale }: Props) { return (
-

Runs

+

{messages.runs}

@@ -67,6 +69,7 @@ export default function RunsPage({ projectId, locale }: Props) { projectId={projectId} runs={runs} onDeleteRun={onDeleteClick} + messages={messages} locale={locale} />
diff --git a/frontend/src/app/[locale]/projects/[projectId]/runs/RunsTable.tsx b/frontend/src/app/[locale]/projects/[projectId]/runs/RunsTable.tsx index 9dca473..6b502b1 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/runs/RunsTable.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/runs/RunsTable.tsx @@ -15,21 +15,14 @@ import { } from "@nextui-org/react"; import { Link, NextUiLinkClasses } from "@/src/navigation"; import { MoreVertical } from "lucide-react"; -import { RunType } from "@/types/run"; +import { RunsMessages, RunType } from "@/types/run"; import dayjs from "dayjs"; -const headerColumns = [ - { name: "ID", uid: "id", sortable: true }, - { name: "Name", uid: "name", sortable: true }, - { name: "Description", uid: "description", sortable: true }, - { name: "Last update", uid: "updatedAt", sortable: true }, - { name: "Actions", uid: "actions" }, -]; - type Props = { projectId: string; runs: RunType[]; onDeleteRun: (runId: number) => void; + messages: RunsMessages; locale: string; }; @@ -37,8 +30,17 @@ export default function RunsTable({ projectId, runs, onDeleteRun, + messages, locale, }: Props) { + const headerColumns = [ + { name: messages.id, uid: "id", sortable: true }, + { name: messages.name, uid: "name", sortable: true }, + { name: messages.description, uid: "description", sortable: true }, + { name: messages.lastUpdate, uid: "updatedAt", sortable: true }, + { name: messages.actions, uid: "actions" }, + ]; + const [sortDescriptor, setSortDescriptor] = useState({ column: "id", direction: "ascending", @@ -97,7 +99,7 @@ export default function RunsTable({ className="text-danger" onClick={() => onDeleteRun(run.id)} > - Delete run + {messages.deleteRun} @@ -146,7 +148,7 @@ export default function RunsTable({ )} - + {(item) => ( {(columnKey) => ( diff --git a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunEditor.tsx b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunEditor.tsx index cb394ac..a921f0f 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunEditor.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunEditor.tsx @@ -35,7 +35,7 @@ import { RunCaseType, RunCaseInfoType, RunStatusCountType, - RunsMessages, + RunMessages, } from "@/types/run"; import { CaseType } from "@/types/case"; import { FolderType } from "@/types/folder"; @@ -64,11 +64,16 @@ const defaultTestRun = { type Props = { projectId: string; runId: string; - messages: RunsMessages; + messages: RunMessages; locale: string; }; -export default function RunEditor({ projectId, runId, messages, locale }: Props) { +export default function RunEditor({ + projectId, + runId, + messages, + locale, +}: Props) { const [testRun, setTestRun] = useState(defaultTestRun); const [folders, setFolders] = useState([]); const [runCases, setRunCases] = useState([]); @@ -218,7 +223,7 @@ export default function RunEditor({ projectId, runId, messages, locale }: Props) <>
- +
@@ -252,7 +257,7 @@ export default function RunEditor({ projectId, runId, messages, locale }: Props)
-

Progress

+

{messages.progress}