diff --git a/i18n.json b/i18n.json
new file mode 100644
index 0000000..9ad0d3a
--- /dev/null
+++ b/i18n.json
@@ -0,0 +1,5 @@
+{
+ "defaultLocale": "en",
+ "locales": ["fr", "en"],
+ "pages": { "*": ["common"], "/": ["home"] }
+}
diff --git a/locales/en/common.json b/locales/en/common.json
new file mode 100644
index 0000000..21d999a
--- /dev/null
+++ b/locales/en/common.json
@@ -0,0 +1,3 @@
+{
+ "walidoux-github": "Walidoux's Github"
+}
diff --git a/locales/en/home.json b/locales/en/home.json
new file mode 100644
index 0000000..79dd280
--- /dev/null
+++ b/locales/en/home.json
@@ -0,0 +1,4 @@
+{
+ "title": "You feel a calming tranquility...",
+ "subtitle": "You're filled with determination."
+}
diff --git a/locales/fr/common.json b/locales/fr/common.json
new file mode 100644
index 0000000..21930e2
--- /dev/null
+++ b/locales/fr/common.json
@@ -0,0 +1,3 @@
+{
+ "walidoux-github": "Github de Walidoux"
+}
diff --git a/locales/fr/home.json b/locales/fr/home.json
new file mode 100644
index 0000000..dafde7a
--- /dev/null
+++ b/locales/fr/home.json
@@ -0,0 +1,4 @@
+{
+ "title": "Vous ressentez une tranquillité apaisante...",
+ "subtitle": "Vous êtes rempli de détermination."
+}
diff --git a/next.config.js b/next.config.js
index 9331f0e..e24fc0c 100644
--- a/next.config.js
+++ b/next.config.js
@@ -1,9 +1,9 @@
-// @ts-check
-
const path = require('path')
+const nextTranslate = require('next-translate')
+
/** @type {import('next').NextConfig} */
-module.exports = {
+const nextConfig = {
reactStrictMode: true,
swcMinify: true,
sassOptions: {
@@ -13,3 +13,5 @@ module.exports = {
]
}
}
+
+module.exports = nextTranslate(nextConfig)
diff --git a/pages/_app.tsx b/pages/_app.tsx
index 891f80d..6ab52ed 100644
--- a/pages/_app.tsx
+++ b/pages/_app.tsx
@@ -1,8 +1,20 @@
+import { useEffect } from 'react'
import type { AppProps } from 'next/app'
+import useTranslation from 'next-translate/useTranslation'
+import Cookies from 'js-cookie'
import '../styles/main.scss'
const MyApp = ({ Component, pageProps }: AppProps): JSX.Element => {
+ const { lang } = useTranslation()
+
+ // 10 years before cookie's expiration
+ const COOKIE_EXPIRATION = 10 * 365.25 * 24 * 60 * 60
+
+ useEffect(() => {
+ Cookies.set('NEXT_LOCALE', lang, { expires: COOKIE_EXPIRATION })
+ }, [lang, COOKIE_EXPIRATION])
+
return
- You feel a calming tranquility...
-
- You're filled with determination.
-
+ {t('home:title')}
+ {t('home:subtitle')}