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

Units of statistics within the statistics menu are untranslatable

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.19, 22w24a, 1.19.1 Pre-release 1, 1.19.1 Pre-release 2, 1.19.1 Pre-release 5, 1.19.1 Release Candidate 2, 1.19.1, 1.19.2, 22w43a, 22w45a, 1.19.3, 1.19.4, 1.20.1, 1.20.2
    • Confirmed
    • Internationalisation
    • Low
    • Platform

      The Bug:

      Units of statistics within the statistics menu, those being "km", "m", "cm", "y", "d", "h", "m", and "s", are all missing translation keys, therefore making them untranslatable.

      Steps to Reproduce:

      1. Attempt to search for the existence of any of these strings by using the appropriate search filters on the official Minecraft crowdin project.
      2. Take note as to whether or not units of statistics within the statistics menu are untranslatable.

      Observed Behavior:

      Units of statistics within the statistics menu are untranslatable.

      Expected Behavior:

      Units of statistics within the statistics menu would be translatable.

      Code Analysis:

      Code analysis by Avoma can be found below.

      The following is based on a decompiled version of Minecraft 22w24a using Mojang mappings.

      net.minecraft.stats.StatFormatter.java
      public interface StatFormatter {
         ...
         public static final StatFormatter DISTANCE = n -> {
            ...
            if (d2 > 0.5) {
               return DECIMAL_FORMAT.format(d2) + " km";
            }
            if (d > 0.5) {
               return DECIMAL_FORMAT.format(d) + " m";
            }
            return n + " cm";
         };
         public static final StatFormatter TIME = n -> {
            ...
            if (d5 > 0.5) {
               return DECIMAL_FORMAT.format(d5) + " y";
            }
            if (d4 > 0.5) {
               return DECIMAL_FORMAT.format(d4) + " d";
            }
            if (d3 > 0.5) {
               return DECIMAL_FORMAT.format(d3) + " h";
            }
            if (d2 > 0.5) {
               return DECIMAL_FORMAT.format(d2) + " m";
            }
            return d + " s";
         };
         ...

      If we look at the above class, we can see that units of statistics within the statistics menu are hardcoded, and as a result, are untranslatable.

            Unassigned Unassigned
            Avoma [Mod] Avoma
            Votes:
            5 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              CHK: