-
-
Notifications
You must be signed in to change notification settings - Fork 928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BetterTooltips Languages Support #4993
Conversation
@@ -282,12 +282,12 @@ private void appendTooltip(ItemStackTooltipEvent event) { | |||
BlockStateComponent blockStateComponent = event.itemStack().get(DataComponentTypes.BLOCK_STATE); | |||
if (blockStateComponent != null) { | |||
String level = blockStateComponent.properties().get("honey_level"); | |||
event.appendStart(Text.literal(String.format("%sHoney level: %s%s%s.", Formatting.GRAY, Formatting.YELLOW, level, Formatting.GRAY))); | |||
event.appendStart(Text.literal(String.format(Text.translatable("modules.better-tooltip.honey-level").getString(), Formatting.GRAY, Formatting.YELLOW, level, Formatting.GRAY))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a single Text.translatable()
with arguments
} | ||
|
||
List<BeehiveBlockEntity.BeeData> bees = event.itemStack().get(DataComponentTypes.BEES); | ||
if (bees != null) { | ||
event.appendStart(Text.literal(String.format("%sBees: %s%d%s.", Formatting.GRAY, Formatting.YELLOW, bees.size(), Formatting.GRAY))); | ||
event.appendStart(Text.literal(String.format(Text.translatable("modules.better-tooltip.bees").getString(), Formatting.GRAY, Formatting.YELLOW, bees.size(), Formatting.GRAY))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a single Text.translatable()
with arguments
@@ -327,7 +327,7 @@ private void getTooltipData(TooltipDataEvent event) { | |||
else if (event.itemStack.getItem() == Items.ENDER_CHEST && previewEChest()) { | |||
event.tooltipData = EChestMemory.isKnown() | |||
? new ContainerTooltipComponent(EChestMemory.ITEMS.toArray(new ItemStack[27]), ECHEST_COLOR) | |||
: new TextTooltipComponent(Text.literal("Unknown ender chest inventory.").formatted(Formatting.DARK_RED)); | |||
: new TextTooltipComponent(Text.literal(Text.translatable("modules.better-tooltip.unknown-ender-chest-inventory").getString()).formatted(Formatting.DARK_RED)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a single Text.translatable()
with arguments
@@ -408,7 +408,7 @@ private void appendPreviewTooltipText(ItemStackTooltipEvent event, boolean space | |||
)) { | |||
// we don't want to add the spacer if the tooltip is hidden | |||
if (spacer) event.appendEnd(Text.literal("")); | |||
event.appendEnd(Text.literal("Hold " + Formatting.YELLOW + keybind + Formatting.RESET + " to preview")); | |||
event.appendEnd(Text.literal(String.format(Text.translatable("modules.better-tooltip.hold-for-preview").getString(), Formatting.YELLOW, keybind, Formatting.RESET))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a single Text.translatable()
with arguments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, you use styled Text
objects as arguments
src/main/java/meteordevelopment/meteorclient/systems/modules/render/BetterTooltips.java
Outdated
Show resolved
Hide resolved
This is something interesting to think about. If we're going to add translations to meteor like this, it would probably make more sense to do it as a whole across the project, rather than module by module. We also need to finish work on the font renderer, as while it does now support many more languages, it's not perfect. Something to discuss after the 1.21.3 update. |
Type of change
Description
Support for different languages for BetterTooltips
Related issues
None
How Has This Been Tested?
Checklist: