[SPIGOT-5827] Player.getLocale always returns en_us Created: 25/Jun/20  Updated: 25/Jun/20  Resolved: 25/Jun/20

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: mindw0rm Assignee: Unassigned
Resolution: Fixed Votes: 1
Labels: 1.16.1, Spigot, bug
Environment:

Virtualbox VM with Xubuntu 18.04

Java: tested both openjdk 1.8.0._252 and openjdk 11.0.7

 


Attachments: File GetLocaleTest-1.0.0-1.jar    
Version: git-Spigot-758abbe-3f0c333 (MC: 1.16.1)
Guidelines Read: Yes

 Description   

Server.getLocale returns en_us even if player is using a different locale.

For testing purposes, and to make sure that there is no intereference with other plugins, I made a new server with only one plugin (see attachment) with the following code:

public void onEnable() {
  Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {

    @Override
    public void run() {
      for (Player p : Bukkit.getOnlinePlayers()) {
        System.out.println(" - locale of " + p.getName() + " is " + p.getLocale());
      }
    }
  }, 100, 200);
 }

The output is always en_us.

This works fine in 1.15.2 (haven't tested previous versions), giving the selected locale (only the first output after login sometimes is en_us). Locale changes during the game also result in the correct locale shown in 1.15.2 and en_us in 1.16.1.

 


Generated at Tue Apr 08 02:45:44 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.