Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-249355

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 1.20.2 Pre-release 1
    • 1.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
    • Confirmed
    • Internationalisation
    • Low
    • Platform

      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 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 ? "-" ...

            slicedlime [Mojang] slicedlime
            Avoma [Mod] Avoma
            Votes:
            7 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: