slider component updated
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
import i18n from "i18next";
|
||||
import { initReactI18next } from "react-i18next";
|
||||
import Backend from "i18next-http-backend";
|
||||
import LanguageDetector from "i18next-browser-languagedetector";
|
||||
|
||||
// import lanaguage files
|
||||
import uzWords from "../public/locales/uz/common.json";
|
||||
import ruWords from "../public/locales/ru/common.json";
|
||||
|
||||
i18n
|
||||
.use(Backend)
|
||||
.use(LanguageDetector)
|
||||
.use(initReactI18next)
|
||||
.init({
|
||||
resources: {
|
||||
uz: { translation: uzWords },
|
||||
ru: { translation: ruWords },
|
||||
},
|
||||
lng: "uz",
|
||||
fallbackLng: "uz",
|
||||
debug: true,
|
||||
});
|
||||
|
||||
export default i18n;
|
||||
5
i18n/navigation.ts
Normal file
5
i18n/navigation.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { createNavigation } from "next-intl/navigation";
|
||||
import { routing } from "./routing";
|
||||
|
||||
export const { Link, redirect, usePathname, useRouter, getPathname } =
|
||||
createNavigation(routing);
|
||||
15
i18n/request.ts
Normal file
15
i18n/request.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { getRequestConfig } from "next-intl/server";
|
||||
import { routing } from "./routing";
|
||||
|
||||
export default getRequestConfig(async ({ requestLocale }) => {
|
||||
let locale = await requestLocale;
|
||||
|
||||
if (!locale || !routing.locales.includes(locale as "uz" | "ru")) {
|
||||
locale = routing.defaultLocale;
|
||||
}
|
||||
|
||||
return {
|
||||
locale,
|
||||
messages: (await import(`../messages/${locale}.json`)).default,
|
||||
};
|
||||
});
|
||||
6
i18n/routing.ts
Normal file
6
i18n/routing.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { defineRouting } from "next-intl/routing";
|
||||
|
||||
export const routing = defineRouting({
|
||||
locales: ["uz", "ru"],
|
||||
defaultLocale: "uz",
|
||||
});
|
||||
Reference in New Issue
Block a user