Added Arabic locale with right to left support (#1220)

I have added arabic locale and modified the _app.tsx code to automatically detect the current language direction and applies it to the while website.
This commit is contained in:
Saifeddine ALOUI
2023-02-06 11:27:59 +09:00
committed by GitHub
parent 40b1b5a32e
commit 56b6595d01
11 changed files with 214 additions and 3 deletions
+7 -2
View File
@@ -13,6 +13,8 @@ import { SWRConfig, SWRConfiguration } from "swr";
import nextI18NextConfig from "../../next-i18next.config.js";
import { Chakra, getServerSideProps } from "../styles/Chakra";
import React, { useEffect } from "react";
type AppPropsWithLayout = AppProps & {
Component: NextPageWithLayout;
};
@@ -25,8 +27,11 @@ const swrConfig: SWRConfiguration = {
function MyApp({ Component, pageProps: { session, cookies, ...pageProps } }: AppPropsWithLayout) {
const getLayout = Component.getLayout ?? getDefaultLayout;
const page = getLayout(<Component {...pageProps} />);
const { t } = useTranslation();
const { t, i18n } = useTranslation();
const direction = i18n.dir();
useEffect(() => {
document.body.dir = direction;
}, [direction]);
return (
<>
<Head>