TranslatableComponent not working on Sign blocks
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 3.5k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 11
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with Component.translatable, GlobalTranslator, SignSide.line, and sign.update on the reported Paper version, then trace how sign lines are serialized and translated for clients. Compare the handling of translatable and styled text; done means a sign displays the resolved ResourceBundle text instead of its translation key.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100