-
Hello, what is the best way to get the browser locale? My application is translated to a small number of languages, but I want to be able to offer the possibility to show dates and numbers with the format that the user wants, for example my app is not translated to japanese but it must support to show dates and numbers in that language. With My idea is to define it giving preference to the user's settings or to what is configured in the browser. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The So if the user prefers Spanish over English, and you support both the If you want the whole list of detected locales you'll have to copy this https://github.com/sergiodxa/remix-i18next/blob/main/src/lib/get-client-locales.ts which is what the language detector class uses internally to get the user locales from the Accept-Language header |
Beta Was this translation helpful? Give feedback.
The
getLocale
method will give you the user locale that the user wants from your supported list of languages.So if the user prefers Spanish over English, and you support both the
getLocale
function will give youes
.If you want the whole list of detected locales you'll have to copy this https://github.com/sergiodxa/remix-i18next/blob/main/src/lib/get-client-locales.ts which is what the language detector class uses internally to get the user locales from the Accept-Language header