Fix runtime default locale resolution
CI / quality (push) Waiting to run

This commit is contained in:
MOH
2026-03-15 06:02:27 +01:00
parent 9b8409a7d3
commit c18128c965
29 changed files with 330 additions and 108 deletions
+4 -4
View File
@@ -6,7 +6,7 @@ import {
type ToastPosition,
} from "react-hot-toast";
import { resolveLocale } from "@/lib/locale";
import { FALLBACK_LOCALE, resolveLocale } from "@/lib/locale";
type ToastVariant = "default" | "success" | "error" | "loading";
@@ -14,13 +14,13 @@ type ToastMessage = string;
function getCurrentLocale() {
if (typeof window === "undefined") {
return "de" as const;
return FALLBACK_LOCALE;
}
const pathname = window.location.pathname;
const maybeLocale = pathname.split("/")[1] || "de";
const maybeLocale = pathname.split("/")[1] || FALLBACK_LOCALE;
return resolveLocale(maybeLocale);
return resolveLocale(maybeLocale, FALLBACK_LOCALE);
}
function getToastPosition(isArabic: boolean): ToastPosition {