Skip to content

Commit a86bb14

Browse files
fix(i18n): add default locales from browser to be able to select them (#2096)
* fix: add default locales from browser to be able to select them * docs: add changeset --------- Co-authored-by: Alexandre Combemorel <[email protected]>
1 parent a06a685 commit a86bb14

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/popular-fans-act.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@scaleway/use-i18n": patch
3+
---
4+
5+
fix default locales browser list

packages/use-i18n/src/usei18n.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ const getCurrentLocale = ({
5353
}): string => {
5454
if (typeof window !== 'undefined') {
5555
const { languages } = navigator
56-
const browserLocales = [...new Set(languages.map(getLocaleFallback))]
56+
const browserLocales = [
57+
...new Set([...languages.map(getLocaleFallback), ...languages]),
58+
]
5759
const currentLocalFromlocalStorage = localStorage.getItem(localeItemStorage)
5860

5961
if (

0 commit comments

Comments
 (0)