Files
StevenandGitHub 4466ba436b chore(examples): use default prettier for examples/templates (#60530)
## 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
2024-01-11 16:01:44 -07:00

42 lines
990 B
JavaScript

import { useEffect } from "react";
import Head from "next/head";
import useI18n from "../hooks/use-i18n";
import Title from "../components/title";
import { contentLanguageMap } from "../lib/i18n";
import EN from "../locales/en.json";
import DE from "../locales/de.json";
const Dashboard = () => {
const i18n = useI18n();
useEffect(() => {
i18n.locale("en", EN);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
return (
<div>
<Head>
<meta
httpEquiv="content-language"
content={contentLanguageMap[i18n.activeLocale]}
/>
</Head>
<Title username="Peter" />
<h2>{i18n.t("intro.text")}</h2>
<h3>{i18n.t("dashboard.description")}</h3>
<div>Current locale: {i18n.activeLocale}</div>
<a
href="#"
onClick={() => {
i18n.locale("de", DE);
}}
>
Change language client-side to 'de'
</a>
</div>
);
};
export default Dashboard;