TranslatableComponent not working on Sign blocks #10643
Labels
priority: low
This issue only describes a minor inconvenience.
status: accepted
Disputed bug is accepted as valid or Feature accepted as desired to be added.
type: bug
Something doesn't work as it was intended to.
version: 1.20.4
Game version 1.20.4
Expected behavior
I expected using Component.translatable(...) would work on Sign blocks. Using server-side translations with GlobalTranslator should show the translated text to the client in a line of a Sign that uses that implementation of Component.
Observed/Actual behavior
In lines that uses TranslatableComponent, it only shows the translation key as text instead of the actual translation from ResourceBundle. I've checked the keys and they're all correct. Styles as color and decorations work well, only the text shown is the problem.
Steps/models to reproduce
Just get a Sign block from a World and try to use Component.translatable(...) to write some of its lines. Update the Sign using the SignSide method.
Here is my code:
MinigameInfo info = minigame.getInfo();
Component[] lines = new Component[4];
lines[0] = Component.text(info.name() + " " + index);
switch(state) {
case AVAILABLE -> {
lines[1] = Component.translatable("minigame.sign.available", NamedTextColor.GREEN);
lines[2] = Component.text(minigame.getWorld().getPlayerCount() + "/"
+ info.maxPlayers(), NamedTextColor.WHITE, TextDecoration.BOLD);
lines[3] = Component.text("» ONLINE «", NamedTextColor.AQUA, TextDecoration.BOLD);
}
case RUNNING -> {
lines[1] = Component.translatable("minigame.sign.running", NamedTextColor.RED);
lines[2] = Component.text(minigame.getWorld().getPlayerCount() + "/"
+ info.maxPlayers(), NamedTextColor.WHITE, TextDecoration.BOLD);
lines[3] = Component.text("» ONLINE «", NamedTextColor.AQUA, TextDecoration.BOLD);
}
case WAITING -> {
lines[1] = Component.empty();
lines[2] = Component.text("-/-", NamedTextColor.WHITE, TextDecoration.BOLD);
lines[3] = Component.translatable("minigame.sign.waiting", NamedTextColor.BLUE, TextDecoration.BOLD);
}
}
SignSide side = sign.getSide(Side.FRONT);
for(int i = 0; i < lines.length; i++) {
side.line(i, lines[i]);
}
sign.update();
Plugin and Datapack List
Plugins:
Datapacks:
Paper version
This server is running Paper version git-Paper-459 (MC: 1.20.4) (Implementing API version 1.20.4-R0.1-SNAPSHOT) (Git: 88419b2)
You are 37 version(s) behind
Download the new version at: https://papermc.io/downloads/paper
Other
No response
The text was updated successfully, but these errors were encountered: