mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
## Description This PR ensures that the default prettier config is used for examples and templates. This config is compatible with `prettier@3` as well (upgrading prettier is bigger change that can be a future PR). ## Changes - Updated `.prettierrc.json` in root with `"trailingComma": "es5"` (will be needed upgrading to prettier@3) - Added `examples/.prettierrc.json` with default config (this will change every example) - Added `packages/create-next-app/templates/.prettierrc.json` with default config (this will change every template) ## Related - Fixes #54402 - Closes #54409
47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
import Link from "next/link";
|
|
import Head from "next/head";
|
|
import Title from "../../components/title";
|
|
import useI18n from "../../hooks/use-i18n";
|
|
import { languages, contentLanguageMap } from "../../lib/i18n";
|
|
|
|
const HomePage = () => {
|
|
const i18n = useI18n();
|
|
|
|
return (
|
|
<div>
|
|
<Head>
|
|
<meta
|
|
httpEquiv="content-language"
|
|
content={contentLanguageMap[i18n.activeLocale]}
|
|
/>
|
|
</Head>
|
|
<Title username="Peter" />
|
|
<h2>{i18n.t("intro.text")}</h2>
|
|
<h3>{i18n.t("intro.description")}</h3>
|
|
<div>Current locale: {i18n.activeLocale}</div>
|
|
<Link href="/[lng]" as="/de">
|
|
Use client-side routing to change language to 'de'
|
|
</Link>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export async function getStaticProps({ params }) {
|
|
const { default: lngDict = {} } = await import(
|
|
`../../locales/${params.lng}.json`
|
|
);
|
|
|
|
return {
|
|
props: { lng: params.lng, lngDict },
|
|
};
|
|
}
|
|
|
|
export async function getStaticPaths() {
|
|
return {
|
|
paths: languages.map((l) => ({ params: { lng: l } })),
|
|
fallback: false,
|
|
};
|
|
}
|
|
|
|
export default HomePage;
|