-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
figure out missing region information #5
Comments
In short, no. |
wow. one would think the browser makers would include this information in the headers since, after all, it's tremendously useful. but thanks for answering the question |
I was a bit quick yesterday, but in the end the answer probably is to get the location from the IP. However there are 2 nuances:
In which case
express()
.use(createLocaleMiddleware({
map: {
language: {
de: 'de_DE'
}
}
}); Depending on your situation the above might be enough to avoid using IP lookups. |
yes, I did notice that sometimes I get a locale. it has to do with the particular list of languages that the browser displays to the user. sometimes you can pick German/Austria and sometimes it's just German. as for the second point, mapping |
You present a region (country) selection to your user when detection fails? For future reference: I guess something like |
@ekkis wrote:
I notice that setting my language preference to Swedish (in Chrome) sets the language to 'sv' but includes no locale, so whereas I might have 'sv-SE' (Sweden), I could also have 'sv-FI' (Finland) but without locale I don't know how to properly format a price (because I don't know the currency). that seems to be browser dependent though as Chrome doesn't set it but Firefox does. so is there a way to tell the locale when the browser has not set it?
The text was updated successfully, but these errors were encountered: