mojira.dev
MC-218631

Cannot specify format with max-decimals in translation strings

String.format in java allows you to specify the number of decimals to show in a formatting string by putting a dot and the number of decimals after the "%" sign.

 

i.e. "%.2f" with the value 3.1416926543560 should yield the result "3.14".

If you do the same using a translation string in a custom language, you get the result: "3.1416926543560".

 

It doesn't seem like a particularly significant bug, since the game only uses %s and %d itself, but since it already supports placement holders ("%1$s %2$s") it would just make everyone's lives easier to include this as well.

 

Related: Even though Mojang is using numerical placeholders in their language files...

"narration.suggestion": "Selected suggestion %d out of %d: %s",

When translations are loaded, they are explicitly stripping them out:

String string = TOKEN_PATTERN.matcher(JsonHelper.asString(entry.getValue(), entry.getKey())).replaceAll("%$1s");
[media]

 

... which is very... uh...

Attachments

Comments 1

Thank you for your report!
However, this issue is Invalid.

You have posted a feature request or a suggestion. This site is for bug reports only.
For suggestions, please visit Minecraft Suggestions on Reddit or visit the Feedback website.

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

Sollace

(Unassigned)

Unconfirmed

(Unassigned)

1.16.5

Retrieved