develop #3
@ -1,15 +1,34 @@
|
||||
import { initI18next } from "@/bootstrap/i18n/i18n";
|
||||
import TranslationsProvider from "@/bootstrap/i18n/i18n-provider";
|
||||
import localFont from "next/font/local";
|
||||
import { PropsWithChildren } from "react";
|
||||
|
||||
const geistSans = localFont({
|
||||
src: "./../fonts/GeistVF.woff",
|
||||
variable: "--font-geist-sans",
|
||||
weight: "100 900",
|
||||
});
|
||||
const geistMono = localFont({
|
||||
src: "./../fonts/GeistMonoVF.woff",
|
||||
variable: "--font-geist-mono",
|
||||
weight: "100 900",
|
||||
});
|
||||
|
||||
export default async function layout(
|
||||
props: PropsWithChildren & { params: Promise<{ lang: string }> },
|
||||
) {
|
||||
const { lang } = await props.params;
|
||||
const { params, children } = props;
|
||||
const { lang } = await params;
|
||||
const { resources } = await initI18next({ lng: lang });
|
||||
return (
|
||||
<html lang={lang}>
|
||||
<body
|
||||
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
||||
>
|
||||
<TranslationsProvider lng={lang} resources={resources}>
|
||||
{props.children}
|
||||
{children}
|
||||
</TranslationsProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
@ -1,35 +1,15 @@
|
||||
import type { Metadata } from "next";
|
||||
import localFont from "next/font/local";
|
||||
import "./globals.css";
|
||||
|
||||
const geistSans = localFont({
|
||||
src: "./fonts/GeistVF.woff",
|
||||
variable: "--font-geist-sans",
|
||||
weight: "100 900",
|
||||
});
|
||||
const geistMono = localFont({
|
||||
src: "./fonts/GeistMonoVF.woff",
|
||||
variable: "--font-geist-mono",
|
||||
weight: "100 900",
|
||||
});
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Create Next App",
|
||||
description: "Generated by create next app",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
export default async function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body
|
||||
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
||||
>
|
||||
{children}
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
return children;
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ import { createInstance, i18n, Resource } from "i18next";
|
||||
import resourcesToBackend from "i18next-resources-to-backend";
|
||||
import { initReactI18next } from "react-i18next/initReactI18next";
|
||||
|
||||
const initI18nextInstance = createInstance();
|
||||
|
||||
export const initI18next = async (params: {
|
||||
lng: string;
|
||||
i18n?: i18n;
|
||||
@ -10,7 +12,7 @@ export const initI18next = async (params: {
|
||||
ns?: string;
|
||||
}) => {
|
||||
const { lng, i18n, ns, resources } = params;
|
||||
const i18nInstance = i18n || createInstance();
|
||||
const i18nInstance = i18n || initI18nextInstance;
|
||||
await i18nInstance
|
||||
.use(initReactI18next)
|
||||
.use(
|
||||
|
Loading…
x
Reference in New Issue
Block a user