Working translation

This commit is contained in:
aronmal 2023-04-16 15:48:08 +02:00
parent 03d66f6d1c
commit df250eddcb
Signed by: aronmal
GPG key ID: 816B7707426FC612
5 changed files with 34 additions and 5 deletions

View file

@ -1,3 +1,8 @@
// @ts-check
/**
* @type {import('next-i18next').UserConfig}
*/
module.exports = {
i18n: {
defaultLocale: "en",

6
pnpm-lock.yaml generated
View file

@ -62,7 +62,7 @@ packages:
resolution: {integrity: sha512-oLcVCTeIFadUoArDTwpluncplrYBmTCCZZgXCbgNGvOBBiSDDK3eWO4b/+eOTli5tKv1lg+a5/NAXg+nTcei1w==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.17.0
'@babel/types': 7.21.4
jsesc: 2.5.2
source-map: 0.5.7
dev: true
@ -118,7 +118,7 @@ packages:
engines: {node: '>=6.0.0'}
hasBin: true
dependencies:
'@babel/types': 7.17.0
'@babel/types': 7.21.4
dev: true
/@babel/runtime@7.21.0:
@ -148,7 +148,7 @@ packages:
'@babel/helper-hoist-variables': 7.18.6
'@babel/helper-split-export-declaration': 7.18.6
'@babel/parser': 7.21.4
'@babel/types': 7.17.0
'@babel/types': 7.21.4
debug: 4.3.4
globals: 11.12.0
transitivePeerDependencies:

View file

@ -0,0 +1,3 @@
{
"cna": "Erstelle Next App"
}

View file

@ -0,0 +1,3 @@
{
"cna": "Create Next App"
}

View file

@ -1,15 +1,26 @@
import styles from "@/styles/Home.module.css"
import { GetStaticProps, InferGetStaticPropsType } from "next"
import { useTranslation } from "next-i18next"
import { serverSideTranslations } from "next-i18next/serverSideTranslations"
import { Inter } from "next/font/google"
import Head from "next/head"
import Image from "next/image"
const inter = Inter({ subsets: ["latin"] })
export default function Home() {
interface Props {
// Add custom props here
}
export default function Home(
_props: InferGetStaticPropsType<typeof getStaticProps>
) {
const { t } = useTranslation("common")
return (
<>
<Head>
<title>Create Next App</title>
<title>{t("cna")}</title>
<meta name="description" content="Generated by create next app" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/favicon.ico" />
@ -112,3 +123,10 @@ export default function Home() {
</>
)
}
// or getServerSideProps: GetServerSideProps<Props> = async ({ locale })
export const getStaticProps: GetStaticProps<Props> = async ({ locale }) => ({
props: {
...(await serverSideTranslations(locale ?? "en", ["common", "footer"])),
},
})