From 4e4c9c4f4f8cfc3e393ca748bbbc3b704bb986fd Mon Sep 17 00:00:00 2001 From: Egor fureunoir Gorbunov Date: Tue, 1 Jul 2025 00:47:37 +0300 Subject: [PATCH] Features: 1) Add i18n support with multiple locales and default locale in next.config; Fixes: 1) Add missing import for useRouter in index.tsx; Extra: n/a; --- storefront/next.config.ts | 25 ++++++++++++++++++++++++- storefront/src/pages/index.tsx | 1 + 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/storefront/next.config.ts b/storefront/next.config.ts index 20873fcc..043ea209 100644 --- a/storefront/next.config.ts +++ b/storefront/next.config.ts @@ -1,7 +1,30 @@ import type {NextConfig} from "next"; const nextConfig: NextConfig = { - /* config options here */ + i18n: { + locales: [ + 'en-gb', + 'ar-ar', + 'cs-cz', + 'da-dk', + 'de-de', + 'en-us', + 'es-es', + 'fr-fr', + 'hi-in', + 'it-it', + 'ja-jp', + 'kk-kz', + 'nl-nl', + 'pl-pl', + 'pt-br', + 'ro-ro', + 'ru-ru', + 'zh-hans' + ], + defaultLocale: 'en-gb', + }, }; + export default nextConfig; diff --git a/storefront/src/pages/index.tsx b/storefront/src/pages/index.tsx index c09a0d42..5168466e 100644 --- a/storefront/src/pages/index.tsx +++ b/storefront/src/pages/index.tsx @@ -1,6 +1,7 @@ import {apolloClient} from 'graphql/apolloClient'; import {GET_PRODUCTS} from 'graphql/queries/getProducts'; import {GetStaticProps} from 'next'; +import {useRouter} from "next/router"; export const getStaticProps: GetStaticProps = async () => { const {data} = await apolloClient.query({