Open j4nos opened 3 years ago
Can you share a reproducible code and what error you're getting?
I tested with
import detectBrowserLanguage from 'detect-browser-language';
import { useState, useEffect } from 'react';
const Home = () => {
const [language, setLanguage] = useState(null);
useEffect(() => {
const language = detectBrowserLanguage();
setLanguage(language);
}, []);
return (
<h1>
Language preference: {language}
</h1>
);
};
export default Home;
And this is the result:
You can set the browser language in the Language & Region
in MacOS.
It detects English though in my Mac OS I have Hungarian language set. Laguage is not set per browser in Mac Safari. Maybe this is the reason of the bug.