Skip to content

Commit

Permalink
Add logging for URL and first subdomain in getLocaleFromRequest func…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
jamalsoueidan committed Jun 11, 2024
1 parent 6431edc commit 842edeb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,11 @@ function getLocaleFromRequest(request: Request): I18nLocale {
} as Record<I18nLocale['country'], I18nLocale['language']>;

const url = new URL(request.url);
console.log(url);
const firstSubdomain = url.hostname
.split('.')[0]
?.toUpperCase() as keyof typeof supportedLocales;
console.log(firstSubdomain);

const language = supportedLocales[firstSubdomain]
? {language: supportedLocales[firstSubdomain], country: firstSubdomain}
Expand Down

0 comments on commit 842edeb

Please sign in to comment.