Skip to content

Commit 9d01538

Browse files
committed
fix localeDetection false
1 parent 34511ff commit 9d01538

File tree

1 file changed

+6
-6
lines changed
  • packages/open-next/src/core/routing/i18n

1 file changed

+6
-6
lines changed

packages/open-next/src/core/routing/i18n/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function detectDomainLocale({
3131
detectedLocale?: string;
3232
}): DomainLocale | undefined {
3333
const i18n = NextConfig.i18n;
34-
if (!i18n || i18n.localeDetection === false || !i18n.domains) {
34+
if (!i18n || !i18n.domains) {
3535
return;
3636
}
3737
const lowercasedLocale = detectedLocale?.toLowerCase();
@@ -54,8 +54,11 @@ export function detectLocale(
5454
internalEvent: InternalEvent,
5555
i18n: i18nConfig,
5656
): string {
57+
const domainLocale = detectDomainLocale({
58+
hostname: internalEvent.headers.host,
59+
});
5760
if (i18n.localeDetection === false) {
58-
return i18n.defaultLocale;
61+
return domainLocale?.defaultLocale ?? i18n.defaultLocale;
5962
}
6063

6164
const cookiesLocale = getLocaleFromCookie(internalEvent.cookies);
@@ -67,10 +70,7 @@ export function detectLocale(
6770
cookiesLocale,
6871
preferredLocale,
6972
defaultLocale: i18n.defaultLocale,
70-
});
71-
72-
const domainLocale = detectDomainLocale({
73-
hostname: internalEvent.headers.host,
73+
domainLocale,
7474
});
7575

7676
return (

0 commit comments

Comments
 (0)