Skip to content

Commit

Permalink
Merge pull request #1515 from zetkin/issue/1469-user-language
Browse files Browse the repository at this point in the history
issue-1469/user-language
  • Loading branch information
rebecarubio authored Sep 19, 2023
2 parents b892f4b + 6c04ac9 commit f6dad06
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions integrationTesting/mockData/users/RosaLuxemburgUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};
Expand Down
2 changes: 1 addition & 1 deletion src/utils/next.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down
1 change: 1 addition & 0 deletions src/utils/types/zetkin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export interface ZetkinUser {
first_name: string;
id: number;
is_superuser?: boolean;
lang: string | null;
last_name: string;
username: string;
}
Expand Down

0 comments on commit f6dad06

Please sign in to comment.