From 8dcb893907b655ccdda1f5d111d473ce7e0fac24 Mon Sep 17 00:00:00 2001 From: Hendrik Schmitz Date: Wed, 31 Jul 2024 22:41:53 +0200 Subject: [PATCH 1/4] Add support for internationalization --- app/[locale]/layout.tsx | 35 ++++++++++++ app/[locale]/page.tsx | 52 +++++++++++++++++ app/layout.tsx | 26 ++------- app/page.tsx | 28 ++-------- components/About.tsx | 70 ++++++++++------------- components/Banner.tsx | 15 +++-- components/Contact.tsx | 21 +++++-- components/DetailedItem.tsx | 5 +- components/Education.tsx | 38 +++++++++---- components/Experience.tsx | 41 +++++++++----- components/Header.module.scss | 24 +++++++- components/Header.tsx | 44 ++++++++++++--- components/Projects.tsx | 87 +++++++++++++++++++++++------ components/Skills.tsx | 4 +- content/education.json | 53 +++++++++++++----- content/experience.json | 92 ++++++++++++++++++++++--------- content/projects.json | 55 ++++++++++++++---- messages/de.json | 40 ++++++++++++++ messages/en.json | 40 ++++++++++++++ public/cv_hendrik_schmitz_de.pdf | Bin 0 -> 1111662 bytes public/cv_hendrik_schmitz_en.pdf | Bin 0 -> 1110811 bytes util/date-time.ts | 16 ++++-- util/i18n.ts | 23 ++++++++ 23 files changed, 604 insertions(+), 205 deletions(-) create mode 100644 app/[locale]/layout.tsx create mode 100644 app/[locale]/page.tsx create mode 100644 messages/de.json create mode 100644 messages/en.json create mode 100644 public/cv_hendrik_schmitz_de.pdf create mode 100644 public/cv_hendrik_schmitz_en.pdf create mode 100644 util/i18n.ts diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx new file mode 100644 index 0000000000..eb3cd32343 --- /dev/null +++ b/app/[locale]/layout.tsx @@ -0,0 +1,35 @@ +import type { Metadata } from "next"; +import "bootstrap/dist/css/bootstrap.min.css"; +import "font-awesome/css/font-awesome.min.css"; +import { supportedLocales } from "@/util/i18n"; +import "../globals.scss"; + +// export const metadata: Metadata = { +// title: "Hendrik Schmitz | Portfolio", +// description: +// "Experienced Fullstack Software Engineer with a strong focus on Frontend Development. Explore my portfolio showcasing innovative web solutions and cutting-edge technology expertise.", +// }; + +//function to generate the routes for all the locales +export async function generateStaticParams() { + return supportedLocales.map((locale) => ({ locale })); +} + +export default function RootLayout({ + children, + params, +}: Readonly<{ + children: React.ReactNode; + params: { + locale: string; + }; +}>) { + return ( + + + + + {children} + + ); +} diff --git a/app/[locale]/page.tsx b/app/[locale]/page.tsx new file mode 100644 index 0000000000..e1b612acbf --- /dev/null +++ b/app/[locale]/page.tsx @@ -0,0 +1,52 @@ +import { notFound } from "next/navigation"; +import { Metadata } from "next"; +import { Locale } from "@/util/i18n"; + +import About from "@/components/About"; +import Banner from "@/components/Banner"; +import Contact from "@/components/Contact"; +import Education from "@/components/Education"; +import Experience from "@/components/Experience"; +import Footer from "@/components/Footer"; +import Header from "@/components/Header"; +import Projects from "@/components/Projects"; +import Skills from "@/components/Skills"; + +export async function generateMetadata( + { params }: { params: { locale: Locale } } +): Promise { + const messages = await getMessages(params.locale); + return messages.metadata; +} + +export default async function Home({ + params, +}: Readonly<{ + params: { + locale: Locale; + }; +}>) { + const messages = await getMessages(params.locale); + + return ( + <> +
+ + + + + + + +