-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
made sure that the i18n does use navigator.languages
instead of navigator.language
for automatic language detection
#4244
made sure that the i18n does use navigator.languages
instead of navigator.language
for automatic language detection
#4244
Conversation
0f148b0
to
3277c06
Compare
navigator.languages
navigator.languages
instead of navigator.language
for automatic language detection
*/ | ||
export function currentLocale() { | ||
const potentialLocales = [ localStorage.locale, navigator.language, navigator.language.substring(0, 2), ...navigator.languages ]; | ||
const availableLocales = potentialLocales.filter(l => languageList[l]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will always skip English because en
(or its variants like en-US
) is not present in languageList
. Users with browser configured to send multiple supported locales will always have interface rendered in first non-English language.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also important to note that en
is not guaranteed to be present in navigator.languages
and instead one or more of its variants (en-US
, en-GB
) will be present as only choice. This should be accounted for!
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma
Tick the checkbox if you understand [x]:
Description
Fixes #4243
=> going through the locale list for matching locales fixes
uk
(butuk-UA
) not being in our localesI have tried to keep the merge conflict betwen this and #3893 to a minimum
Type of change
Please delete any options that are not relevant.
Checklist
Screenshots (if any)
Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically.