From 8c836de71b47744ec3e99cb8b3c853528fa66b52 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Mon, 13 Dec 2021 12:35:10 +0100
Subject: chore: load i18n translations using lingui provider

---
 src/pages/index.tsx | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

(limited to 'src/pages/index.tsx')

diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index 6022497..615fe0a 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -1,5 +1,7 @@
 import Layout from '@components/Layouts/Layout';
 import { NextPageWithLayout } from '@ts/types/app';
+import { loadTranslation } from '@utils/helpers/i18n';
+import { GetStaticProps } from 'next';
 import Head from 'next/head';
 import Image from 'next/image';
 import type { ReactElement } from 'react';
@@ -75,4 +77,17 @@ Home.getLayout = function getLayout(page: ReactElement) {
   return <Layout>{page}</Layout>;
 };
 
+export const getStaticProps: GetStaticProps = async (ctx) => {
+  const translation = await loadTranslation(
+    ctx.locale!,
+    process.env.NODE_ENV === 'production'
+  );
+
+  return {
+    props: {
+      translation,
+    },
+  };
+};
+
 export default Home;
-- 
cgit v1.2.3

