Mojira Archive
MC-249355

The hyphen used within the statistics menu to show a null value is untranslatable

The Bug:

The "-" symbol within the statistics menu used to show a null value is untranslatable and is missing a translation key.

Steps to Reproduce:

  1. Attempt to search for the existence of this string by using this search filter on the official Minecraft crowdin project.
  2. Take note as to whether or not the hyphen used within the statistics menu to show a null value is untranslatable.

Observed Behavior:

The hyphen used within the statistics menu to show a null value is untranslatable.

Expected Behavior:

The hyphen used within the statistics menu to show a null value would be translatable.

Code Analysis:

Code analysis by [Mod] Avoma can be found below.

The following is based on a decompiled version of Minecraft 1.18.2 using MCP-Reborn.

net.minecraft.client.gui.screens.achievement.StatsScreen.java
public class StatsScreen extends Screen implements StatsUpdateListener {
   ...
   class ItemStatisticsList extends ObjectSelectionList<StatsScreen.ItemStatisticsList.ItemRow> {
      ...
      class ItemRow extends ObjectSelectionList.Entry<StatsScreen.ItemStatisticsList.ItemRow> {
         ...
         protected void renderStat(PoseStack $ps, @Nullable Stat<?> $s, int $i0, int $i1, boolean $b) {
            String s = $s == null ? "-" : $s.format(StatsScreen.this.stats.getValue($s));
            GuiComponent.drawString($ps, StatsScreen.this.font, s, $i0 - StatsScreen.this.font.width(s), $i1 + 5, $b ? 16777215 : 9474192);
         }
         ...

If we look at the above class, we can see that the hyphen used within the statistics menu to show a null value is hardcoded, and as a result, is untranslatable. This is evident through the following piece of code:

String s = $s == null ? "-" ...

Fixed

[Mod] Avoma

[Mojang] slicedlime

2022-03-23, 06:48 PM

2023-09-01, 11:26 AM

2023-09-01, 11:26 AM

7

3

Confirmed

Low

Platform

Internationalisation

translatability

1.18.2 - 1.20.11.18.2, 1.19 Pre-release 1, 1.19, 1.19.1, 1.19.2, 22w43a, 22w45a, 1.19.3, 1.19.4, 1.20.1

1.20.2 Pre-release 1