Mojira Archive
MC-253285

Units of statistics within the statistics menu are untranslatable

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 [Mod] 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.

Unresolved

[Mod] Avoma

2022-06-18, 04:02 PM

2024-12-09, 02:03 PM

6

3

Confirmed

Low

Platform

Internationalisation

translatability

1.19 - 1.21.41.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, 1.21, 1.21.4

-