From e9badabe6d57f3560d99f5c772300c2d21fecf41 Mon Sep 17 00:00:00 2001 From: Kim Lan Phan Hoang Date: Fri, 24 May 2024 11:18:40 +0200 Subject: [PATCH] feat: use browser lang (#121) * feat: get lang for map * refactor: use lang * refactor: use navigator lang * refactor: remove lang --- example/App.tsx | 1 + src/components/Map.tsx | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/example/App.tsx b/example/App.tsx index e888b00..6894ddc 100644 --- a/example/App.tsx +++ b/example/App.tsx @@ -31,6 +31,7 @@ const App = (): JSX.Element => { useSuggestionsForAddress={hooks.useSuggestionsForAddress} usePostItem={mutations.usePostItem} useRecycleItems={mutations.useRecycleItems} + lang="fr" /> diff --git a/src/components/Map.tsx b/src/components/Map.tsx index ea6b541..5e66b4d 100644 --- a/src/components/Map.tsx +++ b/src/components/Map.tsx @@ -37,8 +37,10 @@ const Map = ({ useEffect(() => { if (currentMember) { i18n.changeLanguage(currentMember.extra.lang ?? DEFAULT_LANG); + } else { + i18n.changeLanguage(navigator.language ?? DEFAULT_LANG); } - }, [currentMember]); + }, [currentMember, lang]); return (