Files
CraterLib/Common/src/main/java/com/hypherionmc/craterlib/util/LangUtils.java

30 lines
858 B
Java
Raw Normal View History

package com.hypherionmc.craterlib.util;
2022-05-12 00:18:53 +02:00
2024-01-02 00:51:14 +02:00
import com.hypherionmc.craterlib.core.abstraction.text.AbstractComponent;
2022-05-12 00:20:18 +02:00
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
2022-05-12 00:18:53 +02:00
/**
* @author HypherionSA
* Utility class to handle Translation Keys and Formatting
*/
2022-05-12 00:18:53 +02:00
public class LangUtils {
2022-05-12 00:20:18 +02:00
public static Component getTooltipTitle(String key) {
2024-01-02 00:51:14 +02:00
return AbstractComponent.literal(ChatFormatting.YELLOW + AbstractComponent.translatable(key).getString());
2022-05-12 00:18:53 +02:00
}
public static String resolveTranslation(String key) {
2024-01-02 00:51:14 +02:00
return AbstractComponent.translatable(key).getString();
2022-05-12 00:18:53 +02:00
}
2022-05-12 00:20:18 +02:00
public static Component getTranslation(String key) {
2024-01-02 00:51:14 +02:00
return AbstractComponent.translatable(key);
2022-05-12 00:18:53 +02:00
}
2022-05-12 00:20:18 +02:00
public static Component makeComponent(String text) {
2024-01-02 00:51:14 +02:00
return AbstractComponent.translatable(text);
2022-05-12 00:18:53 +02:00
}
}