fix: TranslatableMapper not using fallback translation (#1716)

This commit is contained in:
Emil
2026-01-25 21:56:55 +01:00
committed by GitHub
parent eb2bea79ba
commit fe8dc5eaa2

View File

@@ -43,6 +43,12 @@ public enum TranslatableMapper implements BiConsumer<TranslatableComponent, Cons
final Locale locale = ClosestLocaleMatcher.INSTANCE.lookupClosest(Locale.getDefault()); final Locale locale = ClosestLocaleMatcher.INSTANCE.lookupClosest(Locale.getDefault());
if (GlobalTranslator.translator().canTranslate(translatableComponent.key(), locale)) { if (GlobalTranslator.translator().canTranslate(translatableComponent.key(), locale)) {
componentConsumer.accept(GlobalTranslator.render(translatableComponent, locale)); componentConsumer.accept(GlobalTranslator.render(translatableComponent, locale));
} else {
String fallback = translatableComponent.fallback();
if (fallback == null) {
fallback = translatableComponent.key();
}
componentConsumer.accept(Component.text(fallback));
} }
} }
} }