-
}
- text="Target Kill"
- href="/"
- />
+
} text="TargetKill" href="/" />
}
@@ -32,7 +33,7 @@ const SideBar = () => {
/>
}
- text="Settings"
+ text={t("settings")}
href="/settings"
/>
@@ -44,7 +45,7 @@ const SideBarIcon = ({ href, icon, text = "tooltip 💡" }) => (
{icon}
-
+ {text}
);
@@ -53,7 +54,7 @@ const SideBarMainIcon = ({ href, icon, text = "tooltip 💡" }) => (
{icon}
-
+ {text}
);
diff --git a/layout/generic-layout.jsx b/layout/generic-layout.jsx
index 309dfcf..22e7e01 100644
--- a/layout/generic-layout.jsx
+++ b/layout/generic-layout.jsx
@@ -1,4 +1,3 @@
-import Header from "@/components/Header/header";
import Sidebar from "@/components/Sidebar/Sidebar";
import React from "react";
@@ -6,7 +5,7 @@ function GenericLayout({ children, className }) {
return (
- {children}
+ {children}
);
}
diff --git a/middleware.js b/middleware.js
deleted file mode 100644
index 395264d..0000000
--- a/middleware.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import { authMiddleware } from "@clerk/nextjs";
-export default authMiddleware({
- // "/" will be accessible to all users
- publicRoutes: [
- "/",
- "/settings",
- "/league-of-legends",
- "/league-of-legends/(.*)",
- "/valorant",
- "/valorant/(.*)",
- "/teamfight-tactics",
- "/teamfight-tactics/(.*)",
- ],
-});
-
-export const config = {
- matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
-};
diff --git a/next-i18next.config.js b/next-i18next.config.js
new file mode 100644
index 0000000..bf1ea79
--- /dev/null
+++ b/next-i18next.config.js
@@ -0,0 +1,8 @@
+/** @type {import('next-i18next').UserConfig} */
+module.exports = {
+ i18n: {
+ defaultLocale: "en",
+ locales: ["en", "tr"],
+ },
+ reloadOnPrerender: process.env.NODE_ENV === "development" ? true : false,
+};
diff --git a/next.config.js b/next.config.js
index 077a761..fb77b97 100644
--- a/next.config.js
+++ b/next.config.js
@@ -1,3 +1,5 @@
+const { i18n } = require("./next-i18next.config");
+
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
@@ -9,6 +11,7 @@ const nextConfig = {
});
return config;
},
+ i18n,
};
module.exports = nextConfig;
diff --git a/package-lock.json b/package-lock.json
index f345666..e7a156d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -28,12 +28,15 @@
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"framer-motion": "^10.16.3",
+ "i18next": "^23.5.1",
"next": "13.4.19",
+ "next-i18next": "^14.0.3",
"next-themes": "^0.2.1",
"postcss": "8.4.28",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.45.4",
+ "react-i18next": "^13.2.2",
"react-icons": "^4.10.1",
"react-redux": "^8.1.2",
"react-responsive": "^9.0.2",
@@ -4087,6 +4090,16 @@
"node": ">= 0.6"
}
},
+ "node_modules/core-js": {
+ "version": "3.32.2",
+ "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.32.2.tgz",
+ "integrity": "sha512-pxXSw1mYZPDGvTQqEc5vgIb83jGQKFGYWY76z4a7weZXUolw3G+OvpZqSRcfYOoOVUQJYEPsWeQK8pKEnUtWxQ==",
+ "hasInstallScript": true,
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/core-js"
+ }
+ },
"node_modules/core-js-compat": {
"version": "3.32.1",
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.32.1.tgz",
@@ -4612,11 +4625,46 @@
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
},
+ "node_modules/html-parse-stringify": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/html-parse-stringify/-/html-parse-stringify-3.0.1.tgz",
+ "integrity": "sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg==",
+ "dependencies": {
+ "void-elements": "3.1.0"
+ }
+ },
"node_modules/hyphenate-style-name": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz",
"integrity": "sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ=="
},
+ "node_modules/i18next": {
+ "version": "23.5.1",
+ "resolved": "https://registry.npmjs.org/i18next/-/i18next-23.5.1.tgz",
+ "integrity": "sha512-JelYzcaCoFDaa+Ysbfz2JsGAKkrHiMG6S61+HLBUEIPaF40WMwW9hCPymlQGrP+wWawKxKPuSuD71WZscCsWHg==",
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://locize.com"
+ },
+ {
+ "type": "individual",
+ "url": "https://locize.com/i18next.html"
+ },
+ {
+ "type": "individual",
+ "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project"
+ }
+ ],
+ "dependencies": {
+ "@babel/runtime": "^7.22.5"
+ }
+ },
+ "node_modules/i18next-fs-backend": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/i18next-fs-backend/-/i18next-fs-backend-2.2.0.tgz",
+ "integrity": "sha512-VOPHhdDX0M/csRqEw+9Ectpf6wvTIg1MZDfAHxc3JKnAlJz7fcZSAKAeyDohOq0xuLx57esYpJopIvBaRb0Bag=="
+ },
"node_modules/immer": {
"version": "9.0.21",
"resolved": "https://registry.npmjs.org/immer/-/immer-9.0.21.tgz",
@@ -4983,6 +5031,41 @@
}
}
},
+ "node_modules/next-i18next": {
+ "version": "14.0.3",
+ "resolved": "https://registry.npmjs.org/next-i18next/-/next-i18next-14.0.3.tgz",
+ "integrity": "sha512-FtnjRMfhlamk8YyeyWqd+pndNL+3er83iMZnH4M4mhiGA93l0+vtBUvuObgOAMHDJGLLB2SS2xOOZq69oiJh7A==",
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://locize.com/i18next.html"
+ },
+ {
+ "type": "individual",
+ "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project"
+ },
+ {
+ "type": "individual",
+ "url": "https://locize.com"
+ }
+ ],
+ "dependencies": {
+ "@babel/runtime": "^7.20.13",
+ "@types/hoist-non-react-statics": "^3.3.1",
+ "core-js": "^3",
+ "hoist-non-react-statics": "^3.3.2",
+ "i18next-fs-backend": "^2.1.5"
+ },
+ "engines": {
+ "node": ">=14"
+ },
+ "peerDependencies": {
+ "i18next": "^23.4.6",
+ "next": ">= 12.0.0",
+ "react": ">= 17.0.2",
+ "react-i18next": "^13.2.1"
+ }
+ },
"node_modules/next-themes": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.2.1.tgz",
@@ -5401,6 +5484,27 @@
"react": "^16.8.0 || ^17 || ^18"
}
},
+ "node_modules/react-i18next": {
+ "version": "13.2.2",
+ "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-13.2.2.tgz",
+ "integrity": "sha512-+nFUkbRByFwnrfDcYqvzBuaeZb+nACHx+fAWN/pZMddWOCJH5hoc21+Sa/N/Lqi6ne6/9wC/qRGOoQhJa6IkEQ==",
+ "dependencies": {
+ "@babel/runtime": "^7.22.5",
+ "html-parse-stringify": "^3.0.1"
+ },
+ "peerDependencies": {
+ "i18next": ">= 23.2.3",
+ "react": ">= 16.8.0"
+ },
+ "peerDependenciesMeta": {
+ "react-dom": {
+ "optional": true
+ },
+ "react-native": {
+ "optional": true
+ }
+ }
+ },
"node_modules/react-icons": {
"version": "4.10.1",
"resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.10.1.tgz",
@@ -6145,6 +6249,14 @@
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
+ "node_modules/void-elements": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz",
+ "integrity": "sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/watchpack": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz",
@@ -8811,6 +8923,11 @@
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
"integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw=="
},
+ "core-js": {
+ "version": "3.32.2",
+ "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.32.2.tgz",
+ "integrity": "sha512-pxXSw1mYZPDGvTQqEc5vgIb83jGQKFGYWY76z4a7weZXUolw3G+OvpZqSRcfYOoOVUQJYEPsWeQK8pKEnUtWxQ=="
+ },
"core-js-compat": {
"version": "3.32.1",
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.32.1.tgz",
@@ -9181,11 +9298,32 @@
}
}
},
+ "html-parse-stringify": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/html-parse-stringify/-/html-parse-stringify-3.0.1.tgz",
+ "integrity": "sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg==",
+ "requires": {
+ "void-elements": "3.1.0"
+ }
+ },
"hyphenate-style-name": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz",
"integrity": "sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ=="
},
+ "i18next": {
+ "version": "23.5.1",
+ "resolved": "https://registry.npmjs.org/i18next/-/i18next-23.5.1.tgz",
+ "integrity": "sha512-JelYzcaCoFDaa+Ysbfz2JsGAKkrHiMG6S61+HLBUEIPaF40WMwW9hCPymlQGrP+wWawKxKPuSuD71WZscCsWHg==",
+ "requires": {
+ "@babel/runtime": "^7.22.5"
+ }
+ },
+ "i18next-fs-backend": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/i18next-fs-backend/-/i18next-fs-backend-2.2.0.tgz",
+ "integrity": "sha512-VOPHhdDX0M/csRqEw+9Ectpf6wvTIg1MZDfAHxc3JKnAlJz7fcZSAKAeyDohOq0xuLx57esYpJopIvBaRb0Bag=="
+ },
"immer": {
"version": "9.0.21",
"resolved": "https://registry.npmjs.org/immer/-/immer-9.0.21.tgz",
@@ -9457,6 +9595,18 @@
}
}
},
+ "next-i18next": {
+ "version": "14.0.3",
+ "resolved": "https://registry.npmjs.org/next-i18next/-/next-i18next-14.0.3.tgz",
+ "integrity": "sha512-FtnjRMfhlamk8YyeyWqd+pndNL+3er83iMZnH4M4mhiGA93l0+vtBUvuObgOAMHDJGLLB2SS2xOOZq69oiJh7A==",
+ "requires": {
+ "@babel/runtime": "^7.20.13",
+ "@types/hoist-non-react-statics": "^3.3.1",
+ "core-js": "^3",
+ "hoist-non-react-statics": "^3.3.2",
+ "i18next-fs-backend": "^2.1.5"
+ }
+ },
"next-themes": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.2.1.tgz",
@@ -9708,6 +9858,15 @@
"integrity": "sha512-HGDV1JOOBPZj10LB3+OZgfDBTn+IeEsNOKiq/cxbQAIbKaiJUe/KV8DBUzsx0Gx/7IG/orWqRRm736JwOfUSWQ==",
"requires": {}
},
+ "react-i18next": {
+ "version": "13.2.2",
+ "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-13.2.2.tgz",
+ "integrity": "sha512-+nFUkbRByFwnrfDcYqvzBuaeZb+nACHx+fAWN/pZMddWOCJH5hoc21+Sa/N/Lqi6ne6/9wC/qRGOoQhJa6IkEQ==",
+ "requires": {
+ "@babel/runtime": "^7.22.5",
+ "html-parse-stringify": "^3.0.1"
+ }
+ },
"react-icons": {
"version": "4.10.1",
"resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.10.1.tgz",
@@ -10196,6 +10355,11 @@
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
+ "void-elements": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz",
+ "integrity": "sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w=="
+ },
"watchpack": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz",
diff --git a/package.json b/package.json
index d2f79fd..9a884ba 100644
--- a/package.json
+++ b/package.json
@@ -29,12 +29,15 @@
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"framer-motion": "^10.16.3",
+ "i18next": "^23.5.1",
"next": "13.4.19",
+ "next-i18next": "^14.0.3",
"next-themes": "^0.2.1",
"postcss": "8.4.28",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.45.4",
+ "react-i18next": "^13.2.2",
"react-icons": "^4.10.1",
"react-redux": "^8.1.2",
"react-responsive": "^9.0.2",
diff --git a/pages/_app.js b/pages/_app.js
index 1c9e5fc..da3b268 100644
--- a/pages/_app.js
+++ b/pages/_app.js
@@ -1,5 +1,5 @@
-import { ClerkProvider } from "@clerk/nextjs";
import { ThemeProvider } from "@/providers/theme-provider";
+import { appWithTranslation } from "next-i18next";
import "@/styles/globals.css";
import { Noto_Sans } from "next/font/google";
@@ -12,20 +12,20 @@ const natoSans = Noto_Sans({
display: "swap",
});
-export default function App({ Component, pageProps }) {
+const App = ({ Component, pageProps }) => {
return (
-
-
-
-
+
+
+
-
-
-
-
+
+
+
);
-}
+};
+
+export default appWithTranslation(App);
diff --git a/pages/index.js b/pages/index.js
index 1a8d61d..f418a84 100644
--- a/pages/index.js
+++ b/pages/index.js
@@ -1,6 +1,7 @@
import axios from "axios";
import SearchBar from "@/components/SearchBar/SearchBar";
import GenericLayout from "@/layout/generic-layout";
+import { serverSideTranslations } from "next-i18next/serverSideTranslations";
export default function Home() {
const getSummoner = async () => {
@@ -17,7 +18,7 @@ export default function Home() {
};
return (
-
+
@@ -82,3 +83,11 @@ export default function Home() {
);
}
+
+export async function getServerSideProps({ locale }) {
+ return {
+ props: {
+ ...(await serverSideTranslations(locale, ["common", "sidebar"])),
+ },
+ };
+}
diff --git a/pages/register.js b/pages/register.js
index c33c1cb..253e71d 100644
--- a/pages/register.js
+++ b/pages/register.js
@@ -1,6 +1,5 @@
import Image from "next/image";
import Link from "next/link";
-
import { cn } from "@/lib/utils";
import { buttonVariants } from "@/components/ui/button";
@@ -10,7 +9,7 @@ export default function AuthenticationPage() {
diff --git a/public/locales/en/buttons.json b/public/locales/en/buttons.json
new file mode 100644
index 0000000..e69de29
diff --git a/public/locales/en/common.json b/public/locales/en/common.json
new file mode 100644
index 0000000..e69de29
diff --git a/public/locales/en/home.json b/public/locales/en/home.json
new file mode 100644
index 0000000..e69de29
diff --git a/public/locales/en/login.json b/public/locales/en/login.json
new file mode 100644
index 0000000..e69de29
diff --git a/public/locales/en/register.json b/public/locales/en/register.json
new file mode 100644
index 0000000..e69de29
diff --git a/public/locales/en/sidebar.json b/public/locales/en/sidebar.json
new file mode 100644
index 0000000..d45421e
--- /dev/null
+++ b/public/locales/en/sidebar.json
@@ -0,0 +1,3 @@
+{
+ "settings": "Settings"
+}
diff --git a/public/locales/tr/buttons.json b/public/locales/tr/buttons.json
new file mode 100644
index 0000000..e69de29
diff --git a/public/locales/tr/common.json b/public/locales/tr/common.json
new file mode 100644
index 0000000..e69de29
diff --git a/public/locales/tr/home.json b/public/locales/tr/home.json
new file mode 100644
index 0000000..e69de29
diff --git a/public/locales/tr/login.json b/public/locales/tr/login.json
new file mode 100644
index 0000000..e69de29
diff --git a/public/locales/tr/register.json b/public/locales/tr/register.json
new file mode 100644
index 0000000..e69de29
diff --git a/public/locales/tr/sidebar.json b/public/locales/tr/sidebar.json
new file mode 100644
index 0000000..65ba290
--- /dev/null
+++ b/public/locales/tr/sidebar.json
@@ -0,0 +1,3 @@
+{
+ "settings": "Ayarlar"
+}
diff --git a/styles/globals.css b/styles/globals.css
index 705db30..03a649f 100644
--- a/styles/globals.css
+++ b/styles/globals.css
@@ -6,33 +6,33 @@
@layer base {
:root {
- --background: 0 0% 100%;
- --foreground: 222.2 84% 4.9%;
+ --background: 242, 22%, 6%;
+ --foreground: 210 40% 98%;
- --card: 0 0% 100%;
- --card-foreground: 222.2 84% 4.9%;
+ --card: 222.2 84% 4.9%;
+ --card-foreground: 210 40% 98%;
- --popover: 0 0% 100%;
- --popover-foreground: 222.2 84% 4.9%;
+ --popover: 222.2 84% 4.9%;
+ --popover-foreground: 210 40% 98%;
- --primary: 222.2 47.4% 11.2%;
- --primary-foreground: 210 40% 98%;
+ --primary: 214, 36%, 19%;
+ --primary-foreground: 222.2 47.4% 11.2%;
- --secondary: 210 40% 96.1%;
- --secondary-foreground: 222.2 47.4% 11.2%;
+ --secondary: 217.2 32.6% 17.5%;
+ --secondary-foreground: 210 40% 98%;
- --muted: 210 40% 96.1%;
- --muted-foreground: 215.4 16.3% 46.9%;
+ --muted: 217.2 32.6% 17.5%;
+ --muted-foreground: 215 20.2% 65.1%;
- --accent: 210 40% 96.1%;
- --accent-foreground: 222.2 47.4% 11.2%;
+ --accent: 36, 100%, 61%;
+ --accent-foreground: 172, 100%, 56%;
- --destructive: 0 84.2% 60.2%;
+ --destructive: 0 62.8% 30.6%;
--destructive-foreground: 210 40% 98%;
- --border: 214.3 31.8% 91.4%;
- --input: 214.3 31.8% 91.4%;
- --ring: 222.2 84% 4.9%;
+ --border: 217.2 32.6% 17.5%;
+ --input: 217.2 32.6% 17.5%;
+ --ring: 212.7 26.8% 83.9%;
--radius: 0.5rem;
}