Fix message translation regression

This commit is contained in:
Camotoy 2023-04-26 15:33:36 -04:00
parent 321f98c75d
commit 545087fba4
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F

View file

@ -53,12 +53,14 @@ public class MinecraftTranslationRegistry extends TranslatableComponentRenderer<
// Get the locale string // Get the locale string
String localeString = MinecraftLocale.getLocaleStringIfPresent(key, locale); String localeString = MinecraftLocale.getLocaleStringIfPresent(key, locale);
if (localeString == null) { if (localeString == null) {
if (fallback == null) { if (fallback != null) {
// No fallback and no match for string; nothing will be translated/inserted
return null;
}
// Fallback strings will still have their params inserted // Fallback strings will still have their params inserted
localeString = fallback; localeString = fallback;
} else {
// The original translation will be translated
// Can be tested with 1.19.4: {"translate":"%s","with":[{"text":"weeeeeee"}]}
localeString = key;
}
} }
// Replace the `%s` with numbered inserts `{0}` // Replace the `%s` with numbered inserts `{0}`