diff --git a/integrationTesting/mockData/users/RosaLuxemburgUser.ts b/integrationTesting/mockData/users/RosaLuxemburgUser.ts index 626c1c9977..93531f9f2e 100644 --- a/integrationTesting/mockData/users/RosaLuxemburgUser.ts +++ b/integrationTesting/mockData/users/RosaLuxemburgUser.ts @@ -3,6 +3,7 @@ import { ZetkinUser } from 'utils/types/zetkin'; const RosaLuxemburgUser: ZetkinUser = { first_name: 'Rosa', id: 1, + lang: null, last_name: 'Luxemburg', username: 'red_rosa', }; diff --git a/src/utils/next.ts b/src/utils/next.ts index bbe00fb52a..fb8b4bdb4b 100644 --- a/src/utils/next.ts +++ b/src/utils/next.ts @@ -189,7 +189,7 @@ export const scaffold = const result = (await wrapped(ctx)) || {}; // Figure out browser's preferred language - const lang = getBrowserLanguage(contextFromNext.req); + const lang = ctx.user?.lang || getBrowserLanguage(contextFromNext.req); // TODO: Respect scope from options again //const localeScope = (options?.localeScope ?? []).concat(['misc', 'zui']); diff --git a/src/utils/types/zetkin.ts b/src/utils/types/zetkin.ts index b25ac9198b..b26892a184 100644 --- a/src/utils/types/zetkin.ts +++ b/src/utils/types/zetkin.ts @@ -132,6 +132,7 @@ export interface ZetkinUser { first_name: string; id: number; is_superuser?: boolean; + lang: string | null; last_name: string; username: string; }