package dev.photosync.platform;

import dev.photosync.mcapi.Translator;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.locale.Language;

/**
 * Translations, from the language the player actually selected.
 *
 * <p>{@code I18n.get} falls back to the key when there is no entry, which is
 * what {@link Translator} promises. The existence check goes to {@link Language}
 * rather than {@code I18n.exists} because that method was dropped in 26.1 while
 * {@code Language.has} has been there throughout.
 */
public final class TextAdapter implements Translator {

    @Override
    public String get(String key, Object... arguments) {
        return I18n.get(key, arguments);
    }

    @Override
    public boolean has(String key) {
        return Language.getInstance().has(key);
    }
}
