forked from RyanFitzgerald/devportfolio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from drik98/feature/i18n
Add support for internationalization
- Loading branch information
Showing
23 changed files
with
627 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,6 @@ yarn-error.log* | |
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
# ignore generated pdf files | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<html lang={params.locale}> | ||
<head> | ||
<link rel="icon" href="/favicon.ico" sizes="any" /> | ||
</head> | ||
<body>{children}</body> | ||
</html> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
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<Metadata> { | ||
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 ( | ||
<> | ||
<Header messages={messages} locale={params.locale} /> | ||
<Banner messages={messages} locale={params.locale} /> | ||
<About messages={messages} locale={params.locale} /> | ||
<Experience messages={messages} locale={params.locale} /> | ||
<Education messages={messages} locale={params.locale} /> | ||
<Projects messages={messages} locale={params.locale} /> | ||
<Skills messages={messages} /> | ||
<Contact messages={messages} /> | ||
<Footer /> | ||
</> | ||
); | ||
} | ||
|
||
async function getMessages(locale: string) { | ||
try { | ||
return (await import(`../../messages/${locale}.json`)).default; | ||
} catch (error) { | ||
notFound(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,9 @@ | ||
import type { Metadata } from "next"; | ||
import "bootstrap/dist/css/bootstrap.min.css"; | ||
import "font-awesome/css/font-awesome.min.css"; | ||
import "./globals.scss"; | ||
import { ReactNode } from "react"; | ||
|
||
export const metadata: Metadata = { | ||
title: "Hendrik Schmitz | Mein 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.", | ||
type Props = { | ||
children: ReactNode; | ||
}; | ||
|
||
export default function RootLayout({ | ||
children, | ||
}: Readonly<{ | ||
children: React.ReactNode; | ||
}>) { | ||
return ( | ||
<html lang="de"> | ||
<head> | ||
<link rel="icon" href="/favicon.ico" sizes="any" /> | ||
</head> | ||
<body>{children}</body> | ||
</html> | ||
); | ||
export default function RootLayout({ children }: Props) { | ||
return children; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,9 @@ | ||
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"; | ||
import { redirect } from "next/navigation"; | ||
import { defaultLocale } from "@/util/i18n"; | ||
|
||
/** | ||
* Just redirect to the default language | ||
*/ | ||
export default function Home() { | ||
return ( | ||
<> | ||
<Header /> | ||
<Banner /> | ||
<About /> | ||
<Experience /> | ||
<Education /> | ||
<Projects /> | ||
<Skills /> | ||
<Contact /> | ||
<Footer /> | ||
</> | ||
); | ||
redirect(`/${defaultLocale}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
import styles from "./Contact.module.scss"; | ||
|
||
export default function Contact() { | ||
export default function Contact({ messages }: { messages: any }) { | ||
return ( | ||
<div id="contact" className={styles.contact}> | ||
<h2>Kontakt</h2> | ||
<h2>{messages.header.sections.contact}</h2> | ||
<div className={styles.contactForm}> | ||
<form method="POST" action="https://formspree.io/[email protected]"> | ||
<input | ||
type="hidden" | ||
name="_subject" | ||
value="Kontaktanfrage via Portfolio" | ||
value={messages.contact.emailSubject} | ||
/> | ||
<input type="email" name="_replyto" placeholder="E-Mail" required /> | ||
<textarea name="message" placeholder="Nachricht" required></textarea> | ||
<button type="submit">Send</button> | ||
<input | ||
type="email" | ||
name="_replyto" | ||
placeholder={messages.contact.email} | ||
required | ||
/> | ||
<textarea | ||
name="message" | ||
placeholder={messages.contact.message} | ||
required | ||
></textarea> | ||
<button type="submit">{messages.contact.submit}</button> | ||
</form> | ||
</div> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
5d4de67
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Published on https://smtz.dev as production
🚀 Deployed on https://66aaa786e48fd20fd5336d31--smtz.netlify.app