Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-03 14:50:19 +01:00
Clean-up translation string implementation (#1567)
Dieser Commit ist enthalten in:
Ursprung
67d5993ae1
Commit
0268ef7d2b
@ -32,7 +32,6 @@ import net.kyori.adventure.text.Component;
|
|||||||
import net.kyori.adventure.text.renderer.TranslatableComponentRenderer;
|
import net.kyori.adventure.text.renderer.TranslatableComponentRenderer;
|
||||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
import net.kyori.adventure.translation.TranslationRegistry;
|
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
import org.geysermc.connector.utils.LanguageUtils;
|
import org.geysermc.connector.utils.LanguageUtils;
|
||||||
|
|
||||||
@ -41,8 +40,7 @@ import java.util.*;
|
|||||||
public class MessageTranslator {
|
public class MessageTranslator {
|
||||||
|
|
||||||
// These are used for handling the translations of the messages
|
// These are used for handling the translations of the messages
|
||||||
private static final TranslationRegistry REGISTRY = new MinecraftTranslationRegistry();
|
private static final TranslatableComponentRenderer<Locale> RENDERER = TranslatableComponentRenderer.usingTranslationSource(new MinecraftTranslationRegistry());
|
||||||
private static final TranslatableComponentRenderer<Locale> RENDERER = TranslatableComponentRenderer.usingTranslationSource(REGISTRY);
|
|
||||||
|
|
||||||
// Store team colors for player names
|
// Store team colors for player names
|
||||||
private static final Map<TeamColor, String> TEAM_COLORS = new HashMap<>();
|
private static final Map<TeamColor, String> TEAM_COLORS = new HashMap<>();
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
package org.geysermc.connector.network.translators.chat;
|
package org.geysermc.connector.network.translators.chat;
|
||||||
|
|
||||||
import net.kyori.adventure.key.Key;
|
import net.kyori.adventure.key.Key;
|
||||||
import net.kyori.adventure.translation.TranslationRegistry;
|
import net.kyori.adventure.translation.Translator;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.geysermc.connector.utils.LocaleUtils;
|
import org.geysermc.connector.utils.LocaleUtils;
|
||||||
@ -40,10 +40,10 @@ import java.util.regex.Pattern;
|
|||||||
* This class is used for mapping a translation key with the already loaded Java locale data
|
* This class is used for mapping a translation key with the already loaded Java locale data
|
||||||
* Used in MessageTranslator.java as part of the KyoriPowered/Adventure library
|
* Used in MessageTranslator.java as part of the KyoriPowered/Adventure library
|
||||||
*/
|
*/
|
||||||
public class MinecraftTranslationRegistry implements TranslationRegistry {
|
public class MinecraftTranslationRegistry implements Translator {
|
||||||
@Override
|
@Override
|
||||||
public @NonNull Key name() {
|
public @NonNull Key name() {
|
||||||
return Key.key("", "");
|
return Key.key("geyser", "minecraft_translations");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -73,19 +73,4 @@ public class MinecraftTranslationRegistry implements TranslationRegistry {
|
|||||||
|
|
||||||
return new MessageFormat(sb.toString(), locale);
|
return new MessageFormat(sb.toString(), locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void defaultLocale(@NonNull Locale locale) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void register(@NonNull String key, @NonNull Locale locale, @NonNull MessageFormat format) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void unregister(@NonNull String key) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren