Skip to content

Commit

Permalink
feat: support localeDetection = false
Browse files Browse the repository at this point in the history
  • Loading branch information
alacroix committed Oct 25, 2024
1 parent d762f72 commit 79971ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/open-next/src/core/routing/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ function getLocaleFromCookie(cookies: Record<string, string>) {
}

function detectLocale(internalEvent: InternalEvent, i18n: i18nConfig): string {
if (i18n.localeDetection === false) {
return i18n.defaultLocale;
}

const cookiesLocale = getLocaleFromCookie(internalEvent.cookies);
const preferredLocale = acceptLanguage(
internalEvent.headers["accept-language"],
Expand Down
1 change: 1 addition & 0 deletions packages/open-next/src/types/next-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export type Header = {
export interface i18nConfig {
locales: string[];
defaultLocale: string;
localeDetection?: false;
}
export interface NextConfig {
basePath?: string;
Expand Down

0 comments on commit 79971ec

Please sign in to comment.