top.hendrixshen.magiclib.impl.i18n.minecraft.translation.TranslationContext Maven / Gradle / Ivy
/*
* This file is part of the Carpet TIS Addition project, licensed under the
* GNU Lesser General Public License v3.0
*
* Copyright (C) 2023 Fallen_Breath and contributors
*
* Carpet TIS Addition is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Carpet TIS Addition is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Carpet TIS Addition. If not, see .
*/
package top.hendrixshen.magiclib.impl.i18n.minecraft.translation;
import lombok.Getter;
import top.hendrixshen.magiclib.api.compat.minecraft.network.chat.MutableComponentCompat;
/**
* Reference to Carpet-TIS-Addition
*
*
* With this you can use {@link TranslationContext#tr(String, Object...)} freely in your target class
*/
@Getter
public class TranslationContext {
private final Translator translator;
protected TranslationContext(Translator translator) {
this.translator = translator;
}
protected TranslationContext(String translationPath) {
this(new Translator(translationPath));
}
protected MutableComponentCompat tr(String key, Object... args) {
return this.translator.tr(key, args);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy