Add missing Locale parameter to String.format calls, Fixes getArmorResource functionality on some locaales. (#8463)

This commit is contained in:
Take Weiland authored and GitHub committed 2022-02-15 09:27:10 -08:00
1 parent 21787234f4
commit c3e0b071a2
30 files changed
+107 -80

No files matched your search

@@ -1,6 +1,6 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2021.
* Copyright (c) 2016-2022.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -24,6 +24,8 @@ import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraftforge.fml.ModList;
import java.util.Locale;
import java.util.stream.Collectors;
class ModListCommand {
@@ -35,7 +37,7 @@ class ModListCommand {
ctx.getSource().sendSuccess(new TranslatableComponent("commands.forge.mods.list",
ModList.get().applyForEachModFile(modFile ->
// locator - filename : firstmod (version) - numberofmods\n
String.format("%s %s : %s (%s) - %d",
String.format(Locale.ROOT, "%s %s : %s (%s) - %d",
modFile.getLocator().name().replace(' ', '_'),
modFile.getFileName(),
modFile.getModInfos().get(0).getModId(),
@@ -1,6 +1,6 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2021.
* Copyright (c) 2016-2022.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -29,6 +29,8 @@ import net.minecraft.network.chat.TranslatableComponent;
import net.minecraftforge.network.ConnectionType;
import net.minecraftforge.network.NetworkHooks;
import java.util.Locale;
public class TextComponentHelper
{
private TextComponentHelper() {}
@@ -41,7 +43,7 @@ public class TextComponentHelper
{
if (isVanillaClient(source))
{
return new TextComponent(String.format(Language.getInstance().getOrDefault(translation), args));
return new TextComponent(String.format(Locale.ENGLISH, Language.getInstance().getOrDefault(translation), args));
}
return new TranslatableComponent(translation, args);
}