package eu.mhsl.minenet.minigames.lang;

import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;

public class Lang {

    private final String langId;
    private final Map<String, String> entries = new HashMap<>();

    public Lang(String langId) {
        this.langId = langId;
    }

    public void addEntry(String key, String value) {
        entries.put(key, value);
    }

    public String getEntry(String key) {
        return entries.computeIfAbsent(key, s -> {
            Logger.getLogger("localisation").warning(s + " is not known by translation files!");
            return new DummyLang().getEntry(s);
        });
    }

    public String getLangId() {
        return langId;
    }
}
