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