File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
packages/open-next/src/core/routing/i18n Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff 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 (
You can’t perform that action at this time.
0 commit comments