mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-09 20:30:54 -05:00
31 lines
717 B
TypeScript
31 lines
717 B
TypeScript
import { createCookie } from "@remix-run/node";
|
|
import Backend from "i18next-fs-backend";
|
|
import { resolve } from "node:path";
|
|
import { RemixI18Next } from "remix-i18next";
|
|
import { config } from "./config";
|
|
|
|
const TEN_YEARS_IN_SECONDS = 31_536_000 * 10;
|
|
|
|
export const i18nCookie = createCookie("i18n", {
|
|
sameSite: "lax",
|
|
path: "/",
|
|
maxAge: TEN_YEARS_IN_SECONDS,
|
|
});
|
|
|
|
export const i18next = new RemixI18Next({
|
|
detection: {
|
|
cookie: i18nCookie,
|
|
supportedLanguages: config.supportedLngs,
|
|
fallbackLanguage: config.fallbackLng,
|
|
},
|
|
i18next: {
|
|
...config,
|
|
backend: {
|
|
loadPath: resolve("./public/locales/{{lng}}/{{ns}}.json"),
|
|
},
|
|
},
|
|
backend: Backend,
|
|
});
|
|
|
|
export default i18next;
|