mojira.dev
MC-88484

Decimal numbers are displayed using the default Locale value

The bug

Decimal numbers are displayed by using the format(String format, Object... args) method. However this method uses the current default Locale to determine how the text needs to be formatted. This causes some inconsistency problems as for example using a computer with de (German) as default locale will always use a comma as decimal seperator regardless of the current selected in-game language. A rather problematic bug caused by this is, that for example the text fields of the customized world generation invalidate themselves as only decimal numbers with a point as decimal seperator can be parsed.

How to reproduce (/worldborder set)

The feedback fo the /worldborder set command uses commas as decimal mark instead of points in the default language:

[Client thread/INFO]: [CHAT] Set world border to 10,5 blocks wide (from 10,0 blocks)

How to reproduce (Customized world generation settings)

  1. Open the world generation settings of a customized world

  2. Go the fourth page (should contain text fields)
    The text fields should have commas as decimal separator in case your default locale is de

  3. Try to write something
    You are unable to write because the comma invalidates the input, only after removing it you can add numbers

Possible fixes

  • Mapping for the chat the current in-game language to the according Locale and using for other GUIs the Locale.ENGLISH

  • For each formatting format(Locale l, String format, Object... args)

  • Locale.setDefault(Locale.US); when starting Minecraft

Personally I would prefer the first fix. Additionally instead of formatting with the method of the String class, the DecimalFormat class could be used

Linked issues

Comments 10

Depending on country settings ?

Commas in default language for me.

This doesn't occur to me, is this fixed? (15w43c)

15w43c: Occurs for me, en-us Minecraft.

Confirmed for 1.9

Still in 1.9.1-pre3

Is this still an issue in the latest snapshot 16w44a? If so please update the affected versions.

This is an automated comment on any open or reopened issue with out-of-date affected versions.

Game just sets default to Locale.ROOT

marcono1234

Erik Broes

Confirmed

/worldborder, chat, command-feedback

Minecraft 15w37a, Minecraft 15w43c, Minecraft 15w46a, Minecraft 15w51b, Minecraft 1.9, ..., Minecraft 1.9.1 Pre-Release 3, Minecraft 1.9.4, Minecraft 16w21a, Minecraft 1.10, Minecraft 1.11

Minecraft 16w50a

Retrieved