rsnext/examples/app-dir-i18n-routing/app/[lang]/page.tsx
Jan Kaifer 5fb56312d5
Create i18n example using app-dir and middleware (#44257)
Co-authored-by: Vu Van Dung <joulev.vvd@yahoo.com>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2023-01-05 16:15:29 +01:00

24 lines
614 B
TypeScript

import { getDictionary } from '../../get-dictionary'
import { Locale } from '../../i18n-config'
import Counter from './components/counter'
import LocaleSwitcher from './components/locale-switcher'
export default async function IndexPage({
params: { lang },
}: {
params: { lang: Locale }
}) {
const dictionary = await getDictionary(lang)
return (
<div>
<LocaleSwitcher />
<p>Current locale: {lang}</p>
<p>
This text is rendered on the server:{' '}
{dictionary['server-component'].welcome}
</p>
<Counter dictionary={dictionary.counter} />
</div>
)
}