Skip to content

Commit

Permalink
configured next-i18n, removed app router in favour of using pages sys…
Browse files Browse the repository at this point in the history
…tem. changed pages to JS
  • Loading branch information
ChrisFong604 committed Mar 21, 2024
1 parent b606901 commit 8be8f72
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 57 deletions.
7 changes: 7 additions & 0 deletions next-i18next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** @type {import('next-i18next').UserConfig} */
module.exports = {
i18n: {
defaultLocale: "en",
locales: ["en"],
},
};
9 changes: 7 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/** @type {import('next').NextConfig} */
const nextConfig = {}

module.exports = nextConfig
const { i18n } = require("./next-i18next.config");

const nextConfig = {
i18n,
};

module.exports = nextConfig;
File renamed without changes.
27 changes: 0 additions & 27 deletions src/app/globals.css

This file was deleted.

22 changes: 0 additions & 22 deletions src/app/layout.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions src/app/page.tsx

This file was deleted.

8 changes: 8 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { AppProps } from "next/app";
import { appWithTranslation } from "next-i18next";

function MyApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
}

export default appWithTranslation(MyApp);
18 changes: 18 additions & 0 deletions src/pages/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { serverSideTranslations } from "next-i18next/serverSideTranslations";

export async function getStaticProps({ locale }) {
return {
props: {
...(await serverSideTranslations(locale, ["common", "footer"])),
// Will be passed to the page component as props
},
};
}

export default function Home() {
return (
<>
<p>Stormhacks 2024 is coming!</p>
</>
);
}
8 changes: 7 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
"src/pages/_app.tsx"
],
"exclude": ["node_modules"]
}

0 comments on commit 8be8f72

Please sign in to comment.