load i18n locales from the base url

The locale load path was relative, so any URL with a trailing slash or more than one segment (like /admin/) fetched locales from under that path, got index.html back from the nginx fallback, and broke every UI string. Locales now load from the same base url as the API, which also covers HA ingress and FRIGATE_BASE_PATH.
This commit is contained in:
Josh Hawkins
2026-11-19 13:01:10 -06:00
parent 16b09d5d86
commit 73bf98f5d0
+2 -1
View File
@@ -2,6 +2,7 @@ import i18n, { t } from "i18next";
import { initReactI18next } from "react-i18next"; import { initReactI18next } from "react-i18next";
import HttpBackend from "i18next-http-backend"; import HttpBackend from "i18next-http-backend";
import { EventType } from "@/types/search"; import { EventType } from "@/types/search";
import { baseUrl } from "@/api/baseUrl";
export const getTranslatedLabel = ( export const getTranslatedLabel = (
label: string, label: string,
@@ -33,7 +34,7 @@ i18n
fallbackLng: "en", // use en if detected lng is not available fallbackLng: "en", // use en if detected lng is not available
backend: { backend: {
loadPath: `locales/{{lng}}/{{ns}}.json?v=${import.meta.env.VITE_GIT_COMMIT_HASH || "unknown"}`, loadPath: `${baseUrl}locales/{{lng}}/{{ns}}.json?v=${import.meta.env.VITE_GIT_COMMIT_HASH || "unknown"}`,
}, },
ns: [ ns: [