Apply i18n

This commit is contained in:
Takeshi Kimata
2024-05-05 21:20:56 +09:00
parent 03560f8d17
commit ac9af2d604
15 changed files with 79 additions and 134 deletions

View File

@@ -1,73 +0,0 @@
export type SiteConfig = typeof siteConfig;
export const siteConfig = {
name: "Open Source Test Case Management Tool",
description: "Integrate and manage all your software testing.",
navItems: [
// {
// label: "Home",
// href: "/",
// },
{
label: "About",
href: "/about",
},
{
label: "Projects",
href: "/projects",
},
// {
// label: "Docs",
// href: "/docs",
// },
// {
// label: "Pricing",
// href: "/pricing",
// },
// {
// label: "Blog",
// href: "/blog",
// },
],
navMenuItems: [
{
label: "Profile",
href: "/profile",
},
{
label: "Dashboard",
href: "/dashboard",
},
{
label: "Projects",
href: "/projects",
},
{
label: "Team",
href: "/team",
},
{
label: "Calendar",
href: "/calendar",
},
{
label: "Settings",
href: "/settings",
},
{
label: "Help & Feedback",
href: "/help-feedback",
},
{
label: "Logout",
href: "/logout",
},
],
links: {
github: "https://github.com/kimatata/TestCaseManager",
// twitter: "https://twitter.com/getnextui",
// docs: "https://nextui.org",
// discord: "https://discord.gg/9b6yyZKmH4",
// sponsor: "https://patreon.com/jrgarciadev",
},
};

View File

@@ -1,9 +1,15 @@
{ {
"Index": { "Home": {
"title": "Hello world!" "get_started": "Get Started",
"integrate_and_manage": "Integrate and manage all your software testing."
},
"Header": {
"title": "Open Source Test Case Management Tool",
"description": "Integrate and manage all your software testing",
"projects": "Projects"
}, },
"Projects": { "Projects": {
"projects": "Projects", "projectList": "Project List",
"project": "Project", "project": "Project",
"new_project": "New Project", "new_project": "New Project",
"edit_project": "Edit Project", "edit_project": "Edit Project",
@@ -38,7 +44,7 @@
"please_enter": "Please enter folder name" "please_enter": "Please enter folder name"
}, },
"Cases": { "Cases": {
"test_cases": "Test Cases", "test_case_list": "Test Case List",
"id": "ID", "id": "ID",
"title": "Title", "title": "Title",
"priority": "Priority", "priority": "Priority",
@@ -100,7 +106,7 @@
"max_file_size": "Max. file size" "max_file_size": "Max. file size"
}, },
"Runs": { "Runs": {
"runs": "Test Runs", "run_list": "Test Run List",
"id": "ID", "id": "ID",
"name": "Name", "name": "Name",
"description": "Description", "description": "Description",

View File

@@ -1,9 +1,15 @@
{ {
"Index": { "Home": {
"title": "はろー" "get_started": "テスト管理を始める",
"integrate_and_manage": "ソフトウェア開発にかかわるすべてのテストを統合管理"
},
"Header": {
"title": "オープンソーステストケース管理ツール",
"description": "ソフトウェア開発にかかわるすべてのテストを統合管理",
"projects": "プロジェクト"
}, },
"Projects": { "Projects": {
"projects": "プロジェクト", "projectList": "プロジェクト一覧",
"project": "プロジェクト", "project": "プロジェクト",
"new_project": "新規プロジェクト", "new_project": "新規プロジェクト",
"edit_project": "プロジェクトの編集", "edit_project": "プロジェクトの編集",
@@ -23,7 +29,7 @@
"Project": { "Project": {
"home": "ホーム", "home": "ホーム",
"test_cases": "テストケース", "test_cases": "テストケース",
"test_runs": "テストラン" "test_runs": "テストの実行"
}, },
"Folders": { "Folders": {
"folder": "フォルダー", "folder": "フォルダー",
@@ -38,7 +44,7 @@
"please_enter": "フォルダ名を入力してください" "please_enter": "フォルダ名を入力してください"
}, },
"Cases": { "Cases": {
"test_cases": "テストケース", "test_case_list": "テストケース一覧",
"id": "ID", "id": "ID",
"title": "タイトル", "title": "タイトル",
"priority": "優先度", "priority": "優先度",
@@ -100,18 +106,18 @@
"max_file_size": "最大ファイルサイズ" "max_file_size": "最大ファイルサイズ"
}, },
"Runs": { "Runs": {
"runs": "テストラン", "run_list": "テストの実行一覧",
"id": "ID", "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": { "Run": {
"back_to_runs": "テストラン一覧に戻る", "back_to_runs": "テストの実行一覧に戻る",
"updating": "更新中...", "updating": "更新中...",
"update": "更新", "update": "更新",
"progress": "進捗", "progress": "進捗",
@@ -140,8 +146,8 @@
"skipped": "スキップ", "skipped": "スキップ",
"select_test_case": "テストケースを選択", "select_test_case": "テストケースを選択",
"test_case_selection": "テストケース選択", "test_case_selection": "テストケース選択",
"include_in_run": "テストランに含める", "include_in_run": "テストの実行に含める",
"exclude_from_run": "テストランから除外する", "exclude_from_run": "テストの実行から除外する",
"no_cases_found": "テストケースが見つかりません" "no_cases_found": "テストケースが見つかりません"
} }
} }

View File

@@ -3,10 +3,10 @@ import {
NavbarContent, NavbarContent,
NavbarBrand, NavbarBrand,
NavbarItem, NavbarItem,
Chip,
Link as NextUiLink, Link as NextUiLink,
} from "@nextui-org/react"; } from "@nextui-org/react";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { siteConfig } from "@/config/site";
import { Link } from "@/src/navigation"; import { Link } from "@/src/navigation";
import LangSwitch from "./LangSwitch"; import LangSwitch from "./LangSwitch";
import { ThemeSwitch } from "@/components/theme-switch"; import { ThemeSwitch } from "@/components/theme-switch";
@@ -15,10 +15,10 @@ import { GithubIcon } from "@/components/icons";
import Image from "next/image"; import Image from "next/image";
export default function Header(params: { locale: string }) { export default function Header(params: { locale: string }) {
const t = useTranslations("Index"); const t = useTranslations("Header");
return ( return (
<NextUINavbar maxWidth="xl" position="sticky" className="bg-inherit"> <NextUINavbar maxWidth="full" position="sticky" className="bg-inherit">
<NavbarContent className="basis-1/5 sm:basis-full" justify="start"> <NavbarContent className="basis-1/5 sm:basis-full" justify="start">
<NavbarBrand as="li" className="gap-3 max-w-fit"> <NavbarBrand as="li" className="gap-3 max-w-fit">
<Link <Link
@@ -32,20 +32,29 @@ export default function Header(params: { locale: string }) {
height={32} height={32}
alt="Logo" alt="Logo"
/> />
<p className="font-bold text-inherit">Test Case Manager</p> <p className="font-bold text-inherit">Platest</p>
</Link> </Link>
</NavbarBrand> </NavbarBrand>
{siteConfig.navItems.map((item) => ( <NavbarItem>
<NavbarItem key={item.href}> <Chip size="sm" variant="flat">
<Link <Link
className="data-[active=true]:text-primary data-[active=true]:font-medium" className="data-[active=true]:text-primary data-[active=true]:font-medium"
href={item.href} href="/about"
locale={params.locale} locale={params.locale}
> >
{item.label} 1.0.0-alpha.3
</Link>
</Chip>
</NavbarItem>
<NavbarItem>
<Link
className="data-[active=true]:text-primary data-[active=true]:font-medium"
href="/projects"
locale={params.locale}
>
{t("projects")}
</Link> </Link>
</NavbarItem> </NavbarItem>
))}
</NavbarContent> </NavbarContent>
<NavbarContent className="basis-1 pl-4" justify="end"> <NavbarContent className="basis-1 pl-4" justify="end">

View File

@@ -1,17 +1,15 @@
import "@/styles/globals.css"; import "@/styles/globals.css";
import { Metadata } from "next";
import { siteConfig } from "@/config/site";
import { fontSans } from "@/config/fonts"; import { fontSans } from "@/config/fonts";
import { Providers } from "./providers"; import { Providers } from "./providers";
import Header from "./Header"; import Header from "./Header";
import clsx from "clsx"; import clsx from "clsx";
import { getTranslations } from "next-intl/server";
export const metadata: Metadata = { export async function generateMetadata({ params: { locale } }) {
title: { const t = await getTranslations({ locale, namespace: "Header" });
default: siteConfig.name, return {
template: `%s - ${siteConfig.name}`, title: t("title"),
}, description: t("description"),
description: siteConfig.description,
themeColor: [ themeColor: [
{ media: "(prefers-color-scheme: light)", color: "white" }, { media: "(prefers-color-scheme: light)", color: "white" },
{ media: "(prefers-color-scheme: dark)", color: "black" }, { media: "(prefers-color-scheme: dark)", color: "black" },
@@ -22,10 +20,11 @@ export const metadata: Metadata = {
apple: "/favicon/apple-touch-icon.png", apple: "/favicon/apple-touch-icon.png",
}, },
}; };
}
export default function RootLayout({ export default function RootLayout({
children, children,
params: {locale} params: { locale },
}: { }: {
children: React.ReactNode; children: React.ReactNode;
params: { locale: string }; params: { locale: string };

View File

@@ -4,7 +4,7 @@ import { useTranslations } from "next-intl";
import { Link } from "@/src/navigation"; import { Link } from "@/src/navigation";
export default function Home() { export default function Home() {
const t = useTranslations("Index"); const t = useTranslations("Home");
return ( return (
<section className="flex flex-col items-center justify-center gap-4 py-8 md:py-10"> <section className="flex flex-col items-center justify-center gap-4 py-8 md:py-10">
@@ -13,12 +13,10 @@ export default function Home() {
<h1 className={title()}>Test Case Management Tool&nbsp;</h1> <h1 className={title()}>Test Case Management Tool&nbsp;</h1>
<br /> <br />
<h2 className={subtitle({ class: "text-inherit mt-4" })}> <h2 className={subtitle({ class: "text-inherit mt-4" })}>
Integrate and manage all your software testing. {t("integrate_and_manage")}
</h2> </h2>
</div> </div>
<h1>{t("title")}</h1>
<div className="flex gap-3"> <div className="flex gap-3">
<Link <Link
href="/projects" href="/projects"
@@ -28,7 +26,7 @@ export default function Home() {
variant: "shadow", variant: "shadow",
})} })}
> >
Create first test project {t("get_started")}
</Link> </Link>
</div> </div>
</section> </section>

View File

@@ -83,7 +83,7 @@ export default function ProjectsPage({ messages, locale }: Props) {
return ( return (
<div className="container mx-auto max-w-3xl pt-16 px-6 flex-grow"> <div className="container mx-auto max-w-3xl pt-16 px-6 flex-grow">
<div className="w-full p-3 flex items-center justify-between"> <div className="w-full p-3 flex items-center justify-between">
<h3 className="font-bold">{messages.project}</h3> <h3 className="font-bold">{messages.projectList}</h3>
<div> <div>
<Button <Button
startContent={<Plus size={16} />} startContent={<Plus size={16} />}

View File

@@ -165,7 +165,7 @@ export default function TestCaseTable({
return ( return (
<> <>
<div className="border-b-1 dark:border-neutral-700 w-full p-3 flex items-center justify-between"> <div className="border-b-1 dark:border-neutral-700 w-full p-3 flex items-center justify-between">
<h3 className="font-bold">{messages.testCases}</h3> <h3 className="font-bold">{messages.testCaseList}</h3>
<div> <div>
{(selectedKeys.size > 0 || selectedKeys === "all") && ( {(selectedKeys.size > 0 || selectedKeys === "all") && (
<Button <Button

View File

@@ -8,7 +8,7 @@ export default function Page({
}) { }) {
const t = useTranslations("Cases"); const t = useTranslations("Cases");
const messages = { const messages = {
testCases: t("test_cases"), testCaseList: t("test_case_list"),
id: t("id"), id: t("id"),
title: t("title"), title: t("title"),
priority: t("priority"), priority: t("priority"),

View File

@@ -52,7 +52,7 @@ export default function RunsPage({ projectId, locale, messages }: Props) {
return ( return (
<div className="container mx-auto max-w-3xl pt-6 px-6 flex-grow"> <div className="container mx-auto max-w-3xl pt-6 px-6 flex-grow">
<div className="w-full p-3 flex items-center justify-between"> <div className="w-full p-3 flex items-center justify-between">
<h3 className="font-bold">{messages.runs}</h3> <h3 className="font-bold">{messages.runList}</h3>
<div> <div>
<Button <Button
startContent={<Plus size={16} />} startContent={<Plus size={16} />}

View File

@@ -8,7 +8,7 @@ export default function Page({
}) { }) {
const t = useTranslations("Runs"); const t = useTranslations("Runs");
const messages = { const messages = {
runs: t("runs"), runList: t("run_list"),
id: t("id"), id: t("id"),
name: t("name"), name: t("name"),
description: t("description"), description: t("description"),

View File

@@ -4,7 +4,7 @@ import { useTranslations } from "next-intl";
export default function Page(params: { locale }) { export default function Page(params: { locale }) {
const t = useTranslations("Projects"); const t = useTranslations("Projects");
const messages = { const messages = {
projects: t("projects"), projectList: t("projectList"),
project: t("project"), project: t("project"),
newProject: t("new_project"), newProject: t("new_project"),
editProject: t("edit_project"), editProject: t("edit_project"),

View File

@@ -50,7 +50,7 @@ type AttachmentType = {
}; };
export type CasesMessages = { export type CasesMessages = {
testCases: string; testCaseList: string;
id: string; id: string;
title: string; title: string;
priority: string; priority: string;

View File

@@ -7,7 +7,7 @@ export type ProjectType = {
}; };
export type ProjectsMessages = { export type ProjectsMessages = {
project: string; projectList: string;
projects: string; projects: string;
newProject: string; newProject: string;
editProject: string; editProject: string;

View File

@@ -27,7 +27,7 @@ type RunStatusCountType = {
}; };
type RunsMessages = { type RunsMessages = {
runs: string, runList: string,
id: string; id: string;
name: string; name: string;
description: string; description: string;