feat: add server settings for default board, default color scheme and default locale (#1373)
* feat: add server settings for default board, default color scheme and default locale * chore: address pull request feedback * test: adjust unit tests to match requirements * fix: deepsource issue * chore: add deepsource as dependency to translation library * refactor: restructure language-combobox, adjust default locale for next-intl * chore: change cookie keys prefix from homarr- to homarr.
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
import type { NextRequest } from "next/server";
|
||||
|
||||
import { I18nMiddleware } from "@homarr/translation/middleware";
|
||||
import { fetchApi } from "@homarr/api/client";
|
||||
import { createI18nMiddleware } from "@homarr/translation/middleware";
|
||||
|
||||
export function middleware(request: NextRequest) {
|
||||
return I18nMiddleware(request);
|
||||
export async function middleware(request: NextRequest) {
|
||||
const culture = await fetchApi.serverSettings.getCulture.query();
|
||||
|
||||
// We don't want to fallback to accept-language header so we clear it
|
||||
request.headers.set("accept-language", "");
|
||||
const next = createI18nMiddleware(culture.defaultLocale);
|
||||
return next(request);
|
||||
}
|
||||
|
||||
export const config = {
|
||||
|
||||
Reference in New Issue
Block a user