From ac9af2d604d219e6da9033c0adb67d7a945aa984 Mon Sep 17 00:00:00 2001 From: Takeshi Kimata <117462761+kimatata@users.noreply.github.com> Date: Sun, 5 May 2024 21:20:56 +0900 Subject: [PATCH] Apply i18n --- frontend/config/site.ts | 73 ------------------- frontend/messages/en.json | 16 ++-- frontend/messages/ja.json | 30 +++++--- frontend/src/app/[locale]/Header.tsx | 29 +++++--- frontend/src/app/[locale]/layout.tsx | 39 +++++----- frontend/src/app/[locale]/page.tsx | 8 +- .../app/[locale]/projects/ProjectsPage.tsx | 2 +- .../[folderId]/cases/TestCaseTable.tsx | 2 +- .../folders/[folderId]/cases/page.tsx | 2 +- .../projects/[projectId]/runs/RunsPage.tsx | 2 +- .../projects/[projectId]/runs/page.tsx | 2 +- frontend/src/app/[locale]/projects/page.tsx | 2 +- frontend/types/case.ts | 2 +- frontend/types/project.ts | 2 +- frontend/types/run.ts | 2 +- 15 files changed, 79 insertions(+), 134 deletions(-) delete mode 100644 frontend/config/site.ts diff --git a/frontend/config/site.ts b/frontend/config/site.ts deleted file mode 100644 index 068060e..0000000 --- a/frontend/config/site.ts +++ /dev/null @@ -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", - }, -}; diff --git a/frontend/messages/en.json b/frontend/messages/en.json index cb2d0c6..28adbbc 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -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", diff --git a/frontend/messages/ja.json b/frontend/messages/ja.json index 3be6e95..f5ca2b9 100644 --- a/frontend/messages/ja.json +++ b/frontend/messages/ja.json @@ -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": "テストケースが見つかりません" } } diff --git a/frontend/src/app/[locale]/Header.tsx b/frontend/src/app/[locale]/Header.tsx index 22b8e30..ff435cd 100644 --- a/frontend/src/app/[locale]/Header.tsx +++ b/frontend/src/app/[locale]/Header.tsx @@ -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 ( - + -

Test Case Manager

+

Platest

- {siteConfig.navItems.map((item) => ( - + + - {item.label} + 1.0.0-alpha.3 - - ))} + + + + + {t("projects")} + +
diff --git a/frontend/src/app/[locale]/layout.tsx b/frontend/src/app/[locale]/layout.tsx index 18990c0..9bb10f3 100644 --- a/frontend/src/app/[locale]/layout.tsx +++ b/frontend/src/app/[locale]/layout.tsx @@ -1,34 +1,33 @@ 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, - themeColor: [ - { media: "(prefers-color-scheme: light)", color: "white" }, - { media: "(prefers-color-scheme: dark)", color: "black" }, - ], - icons: { - icon: "/favicon/favicon.ico", - shortcut: "/favicon/favicon-16x16.png", - apple: "/favicon/apple-touch-icon.png", - }, -}; +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" }, + ], + icons: { + icon: "/favicon/favicon.ico", + shortcut: "/favicon/favicon-16x16.png", + apple: "/favicon/apple-touch-icon.png", + }, + }; +} export default function RootLayout({ children, - params: {locale} + params: { locale }, }: { children: React.ReactNode; - params: {locale: string}; + params: { locale: string }; }) { return ( diff --git a/frontend/src/app/[locale]/page.tsx b/frontend/src/app/[locale]/page.tsx index e2423f8..4400fde 100644 --- a/frontend/src/app/[locale]/page.tsx +++ b/frontend/src/app/[locale]/page.tsx @@ -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 (
@@ -13,12 +13,10 @@ export default function Home() {

Test Case Management Tool 


- Integrate and manage all your software testing. + {t("integrate_and_manage")}

-

{t("title")}

-
- Create first test project + {t("get_started")}
diff --git a/frontend/src/app/[locale]/projects/ProjectsPage.tsx b/frontend/src/app/[locale]/projects/ProjectsPage.tsx index d8dd657..eca878e 100644 --- a/frontend/src/app/[locale]/projects/ProjectsPage.tsx +++ b/frontend/src/app/[locale]/projects/ProjectsPage.tsx @@ -83,7 +83,7 @@ export default function ProjectsPage({ messages, locale }: Props) { return (
-

{messages.project}

+

{messages.projectList}