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": {
"title": "Hello world!"
"Home": {
"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",
"projectList": "Project List",
"project": "Project",
"new_project": "New Project",
"edit_project": "Edit Project",
@@ -38,7 +44,7 @@
"please_enter": "Please enter folder name"
},
"Cases": {
"test_cases": "Test Cases",
"test_case_list": "Test Case List",
"id": "ID",
"title": "Title",
"priority": "Priority",
@@ -100,7 +106,7 @@
"max_file_size": "Max. file size"
},
"Runs": {
"runs": "Test Runs",
"run_list": "Test Run List",
"id": "ID",
"name": "Name",
"description": "Description",

View File

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

View File

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

View File

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

View File

@@ -4,7 +4,7 @@ import { useTranslations } from "next-intl";
import { Link } from "@/src/navigation";
export default function Home() {
const t = useTranslations("Index");
const t = useTranslations("Home");
return (
<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>
<br />
<h2 className={subtitle({ class: "text-inherit mt-4" })}>
Integrate and manage all your software testing.
{t("integrate_and_manage")}
</h2>
</div>
<h1>{t("title")}</h1>
<div className="flex gap-3">
<Link
href="/projects"
@@ -28,7 +26,7 @@ export default function Home() {
variant: "shadow",
})}
>
Create first test project
{t("get_started")}
</Link>
</div>
</section>

View File

@@ -83,7 +83,7 @@ export default function ProjectsPage({ messages, locale }: Props) {
return (
<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">
<h3 className="font-bold">{messages.project}</h3>
<h3 className="font-bold">{messages.projectList}</h3>
<div>
<Button
startContent={<Plus size={16} />}

View File

@@ -165,7 +165,7 @@ export default function TestCaseTable({
return (
<>
<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>
{(selectedKeys.size > 0 || selectedKeys === "all") && (
<Button

View File

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

View File

@@ -52,7 +52,7 @@ export default function RunsPage({ projectId, locale, messages }: Props) {
return (
<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">
<h3 className="font-bold">{messages.runs}</h3>
<h3 className="font-bold">{messages.runList}</h3>
<div>
<Button
startContent={<Plus size={16} />}

View File

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

View File

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

View File

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

View File

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

View File

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