Implement per player locale (Implements #2029) #2502
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This implements a per-player locale system like requested in #2029 which uses the client's language setting by default and adds a command to allow players to change their own locale on the server without changing the client language. The original
localeconfig setting now acts as the default language when no locale is available for the player's locale or, ifchange-localeis disabled in the config behaves exactly like before using the same locale for all players (should be default with an old config).This change goes along with moving all translations that get send from the static I18n.tl method to one provided by the User/CommandSource to get translations depending on the selected locale and also a convenience method sendTl to directly send translations.
Edit: Forgot to mention it: This also includes a provider for getting the client's locale on older versions that didn't include the locale API to keep this functionality backwards compatible.
Closes #2029