Apply i18n
This commit is contained in:
@@ -107,7 +107,7 @@ export default function TestCaseTable({
|
||||
color={priorities[cellValue].color}
|
||||
fill={priorities[cellValue].color}
|
||||
/>
|
||||
<div className="ms-3">{priorities[cellValue].name}</div>
|
||||
<div className="ms-3">{messages[priorities[cellValue].uid]}</div>
|
||||
</div>
|
||||
);
|
||||
case "actions":
|
||||
|
||||
@@ -14,7 +14,7 @@ import { Save, Plus, ArrowLeft, ArrowUpFromLine, Circle } from "lucide-react";
|
||||
import { priorities, testTypes, templates } from "@/config/selection";
|
||||
import CaseStepsEditor from "./CaseStepsEditor";
|
||||
import CaseAttachmentsEditor from "./CaseAttachmentsEditor";
|
||||
import { CaseType, AttachmentType } from "@/types/case";
|
||||
import { CaseType, AttachmentType, CaseMessages } from "@/types/case";
|
||||
import { fetchCase, updateCase } from "../caseControl";
|
||||
import { fetchCreateStep, fetchDeleteStep } from "./stepControl";
|
||||
import {
|
||||
@@ -44,6 +44,7 @@ export default function CaseEditor({
|
||||
projectId: string;
|
||||
folderId: string;
|
||||
caseId: string;
|
||||
messages: CaseMessages;
|
||||
locale: string;
|
||||
};
|
||||
}) {
|
||||
@@ -253,7 +254,7 @@ export default function CaseEditor({
|
||||
>
|
||||
{priorities.map((priority, index) => (
|
||||
<SelectItem key={priority.uid} value={index}>
|
||||
{priority.name}
|
||||
{params.messages[priority.uid]}
|
||||
</SelectItem>
|
||||
))}
|
||||
</Select>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import CaseEditor from "./CaseEditor";
|
||||
import { useTranslations } from "next-intl";
|
||||
|
||||
export default function Page({
|
||||
params,
|
||||
@@ -10,12 +11,21 @@ export default function Page({
|
||||
locale: string;
|
||||
};
|
||||
}) {
|
||||
const t = useTranslations("Case");
|
||||
const messages = {
|
||||
critical: t("critical"),
|
||||
high: t("high"),
|
||||
medium: t("medium"),
|
||||
low: t("low"),
|
||||
};
|
||||
|
||||
return (
|
||||
<CaseEditor
|
||||
params={{
|
||||
projectId: params.projectId,
|
||||
folderId: params.folderId,
|
||||
caseId: params.caseId,
|
||||
messages: messages,
|
||||
locale: params.locale,
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -9,10 +9,6 @@ export default function Page({
|
||||
const t = useTranslations("Cases");
|
||||
const messages = {
|
||||
testCases: t("test_cases"),
|
||||
// folder: t("folder"),
|
||||
// newFolder: t("new_folder"),
|
||||
|
||||
// deleteFolder: t("delete_folder"),
|
||||
id: t("id"),
|
||||
title: t("title"),
|
||||
priority: t("priority"),
|
||||
@@ -20,12 +16,11 @@ export default function Page({
|
||||
deleteCase: t("delete_case"),
|
||||
delete: t("delete"),
|
||||
newTestCase: t("new_test_case"),
|
||||
// projectName: t("folder_name"),
|
||||
// projectDetail: t("folder_detail"),
|
||||
// close: t("close"),
|
||||
// create: t("create"),
|
||||
// update: t("update"),
|
||||
// pleaseEnter: t("please_enter"),
|
||||
status: t("status"),
|
||||
critical: t("critical"),
|
||||
high: t("high"),
|
||||
medium: t("medium"),
|
||||
low: t("low"),
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -35,6 +35,7 @@ import {
|
||||
RunCaseType,
|
||||
RunCaseInfoType,
|
||||
RunStatusCountType,
|
||||
RunsMessages,
|
||||
} from "@/types/run";
|
||||
import { CaseType } from "@/types/case";
|
||||
import { FolderType } from "@/types/folder";
|
||||
@@ -63,10 +64,11 @@ const defaultTestRun = {
|
||||
type Props = {
|
||||
projectId: string;
|
||||
runId: string;
|
||||
messages: RunsMessages;
|
||||
locale: string;
|
||||
};
|
||||
|
||||
export default function RunEditor({ projectId, runId, locale }: Props) {
|
||||
export default function RunEditor({ projectId, runId, messages, locale }: Props) {
|
||||
const [testRun, setTestRun] = useState<RunType>(defaultTestRun);
|
||||
const [folders, setFolders] = useState([]);
|
||||
const [runCases, setRunCases] = useState<RunCaseType[]>([]);
|
||||
@@ -338,13 +340,13 @@ export default function RunEditor({ projectId, runId, locale }: Props) {
|
||||
startContent={<CopyPlus size={16} />}
|
||||
onClick={() => handleBulkIncludeExcludeCases(true)}
|
||||
>
|
||||
Include selected cases in run
|
||||
{messages.includeInRun}
|
||||
</DropdownItem>
|
||||
<DropdownItem
|
||||
startContent={<CopyMinus size={16} />}
|
||||
onClick={() => handleBulkIncludeExcludeCases(false)}
|
||||
>
|
||||
Exclude selected cases from run
|
||||
{messages.excludeFromRun}
|
||||
</DropdownItem>
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
@@ -385,6 +387,7 @@ export default function RunEditor({ projectId, runId, locale }: Props) {
|
||||
onExcludeCase={(excludeCaseId) =>
|
||||
handleIncludeExcludeCase(false, excludeCaseId)
|
||||
}
|
||||
messages={messages}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -27,14 +27,7 @@ import {
|
||||
} from "lucide-react";
|
||||
import { priorities, testRunCaseStatus } from "@/config/selection";
|
||||
import { CaseType } from "@/types/case";
|
||||
|
||||
const headerColumns = [
|
||||
{ name: "ID", uid: "id", sortable: true },
|
||||
{ name: "Title", uid: "title", sortable: true },
|
||||
{ name: "Priority", uid: "priority", sortable: true },
|
||||
{ name: "Status", uid: "runStatus", sortable: true },
|
||||
{ name: "Actions", uid: "actions" },
|
||||
];
|
||||
import { RunsMessages } from "@/types/run";
|
||||
|
||||
type Props = {
|
||||
cases: CaseType[];
|
||||
@@ -43,6 +36,7 @@ type Props = {
|
||||
onStatusChange: (changeCaseId: number, status: number) => {};
|
||||
onIncludeCase: (includeCaseId: number) => {};
|
||||
onExcludeCase: (excludeCaseId: number) => {};
|
||||
messages: RunsMessages;
|
||||
};
|
||||
|
||||
export default function TestCaseSelector({
|
||||
@@ -52,7 +46,16 @@ export default function TestCaseSelector({
|
||||
onStatusChange,
|
||||
onIncludeCase,
|
||||
onExcludeCase,
|
||||
messages,
|
||||
}: Props) {
|
||||
const headerColumns = [
|
||||
{ name: messages.id, uid: "id", sortable: true },
|
||||
{ name: messages.title, uid: "title", sortable: true },
|
||||
{ name: messages.priority, uid: "priority", sortable: true },
|
||||
{ name: messages.status, uid: "runStatus", sortable: true },
|
||||
{ name: messages.actions, uid: "actions" },
|
||||
];
|
||||
|
||||
const [sortDescriptor, setSortDescriptor] = useState<SortDescriptor>({
|
||||
column: "id",
|
||||
direction: "ascending",
|
||||
@@ -102,7 +105,7 @@ export default function TestCaseSelector({
|
||||
color={isIncluded ? priorities[cellValue].color : "#d4d4d8"}
|
||||
fill={isIncluded ? priorities[cellValue].color : "#d4d4d8"}
|
||||
/>
|
||||
<div className="ms-3">{priorities[cellValue].name}</div>
|
||||
<div className="ms-3">{messages[priorities[cellValue].uid]}</div>
|
||||
</div>
|
||||
);
|
||||
case "runStatus":
|
||||
@@ -120,7 +123,7 @@ export default function TestCaseSelector({
|
||||
endContent={isIncluded && <ChevronDown size={16} />}
|
||||
>
|
||||
<span className="w-12">
|
||||
{isIncluded && testRunCaseStatus[cellValue].name}
|
||||
{isIncluded && messages[testRunCaseStatus[cellValue].uid]}
|
||||
</span>
|
||||
</Button>
|
||||
</DropdownTrigger>
|
||||
@@ -131,7 +134,7 @@ export default function TestCaseSelector({
|
||||
startContent={renderStatusIcon(runCaseStatus.uid)}
|
||||
onPress={() => onStatusChange(testCase.id, index)}
|
||||
>
|
||||
{runCaseStatus.name}
|
||||
{messages[runCaseStatus.uid]}
|
||||
</DropdownItem>
|
||||
))}
|
||||
</DropdownMenu>
|
||||
@@ -151,14 +154,14 @@ export default function TestCaseSelector({
|
||||
isDisabled={testCase.isIncluded}
|
||||
onPress={() => onIncludeCase(testCase.id)}
|
||||
>
|
||||
Include in run
|
||||
{messages.includeInRun}
|
||||
</DropdownItem>
|
||||
<DropdownItem
|
||||
startContent={<CopyMinus size={16} />}
|
||||
isDisabled={!testCase.isIncluded}
|
||||
onPress={() => onExcludeCase(testCase.id)}
|
||||
>
|
||||
Exclude from run
|
||||
{messages.excludeFromRun}
|
||||
</DropdownItem>
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
@@ -215,7 +218,7 @@ export default function TestCaseSelector({
|
||||
</TableColumn>
|
||||
)}
|
||||
</TableHeader>
|
||||
<TableBody emptyContent={"No cases found"} items={sortedItems}>
|
||||
<TableBody emptyContent={messages.noCasesFound} items={sortedItems}>
|
||||
{(item) => (
|
||||
<TableRow
|
||||
key={item.id}
|
||||
|
||||
@@ -1,14 +1,37 @@
|
||||
import RunEditor from "./RunEditor";
|
||||
import { useTranslations } from "next-intl";
|
||||
|
||||
export default function Page({
|
||||
params,
|
||||
}: {
|
||||
params: { projectId: string; runId: string; locale: string };
|
||||
}) {
|
||||
const t = useTranslations("Runs");
|
||||
const messages = {
|
||||
id: t("id"),
|
||||
title: t("title"),
|
||||
priority: t("priority"),
|
||||
actions: t("actions"),
|
||||
status: t("status"),
|
||||
critical: t("critical"),
|
||||
high: t("high"),
|
||||
medium: t("medium"),
|
||||
low: t("low"),
|
||||
untested: t("untested"),
|
||||
passed: t("passed"),
|
||||
failed: t("failed"),
|
||||
retest: t("retest"),
|
||||
skipped: t("skipped"),
|
||||
includeInRun: t("include_in_run"),
|
||||
excludeFromRun: t("exclude_from_run"),
|
||||
noCasesFound: t("no_cases_found"),
|
||||
};
|
||||
|
||||
return (
|
||||
<RunEditor
|
||||
projectId={params.projectId}
|
||||
runId={params.runId}
|
||||
messages={messages}
|
||||
locale={params.locale}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user