Skip to content

Commit

Permalink
remove console warning in localeDetector when invalid accept-langua…
Browse files Browse the repository at this point in the history
…ge header present
  • Loading branch information
dcporter44 committed May 20, 2024
1 parent 192e4cc commit c83a837
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 5.4.3

- Remove console warning in `localeDetector` when invalid accept-language header present

## 5.4.2

- Fixes bug where `noPrefix` did not use `localeDetector` when no cookie present
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next-i18n-router",
"version": "5.4.2",
"version": "5.4.3",
"description": "Next.js App Router internationalized routing and locale detection.",
"repository": "https://github.com/i18nexus/next-i18n-router",
"keywords": [
Expand Down
3 changes: 1 addition & 2 deletions src/localeDetector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ function localeDetector(request: NextRequest, config: Config): string {
try {
return match(languages, config.locales, config.defaultLocale);
} catch (e) {
console.warn(`No valid locales in accept-language header: ${languages}`);
console.warn(`Reverting to using defaultLocale: ${config.defaultLocale}`);
// invalid accept-language header

return config.defaultLocale;
}
Expand Down

0 comments on commit c83a837

Please sign in to comment.