Skip to content
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

Automatically set translation according to browser settings #615

Merged

Conversation

NikitaCartes
Copy link
Member

Second commit fixes problem with languages not always being saved correctly. Can be recreated in demo.

Added useBrowserLanguage setting in web/lang/settings.json. If set to false, behavior will be as now.

Language selection algorithm:

  1. Take the first element of navigator.languages
  2. If it appears in list of available languages, set locale to it (this is why few locales have been renamed to comply with RFC 5646)
  3. If not, take base language (en in en-US) and find locale that starts with it
  4. If such a locale isn't found, repeat for the rest of navigator.languages

@NikitaCartes
Copy link
Member Author

Based on this message

Copy link
Member

@TBlueF TBlueF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks!

@TBlueF TBlueF merged commit e59d035 into BlueMap-Minecraft:master Oct 9, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants