Skip to content

Commit

Permalink
Close #3786 Add support for naming tag categories
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Oct 4, 2024
1 parent 14a3ed6 commit f3e13fd
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 10 deletions.
5 changes: 4 additions & 1 deletion Common/src/main/resources/assets/jei/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,10 @@
"gui.jei.category.compostable.chance": "Chance: %s%%",
"gui.jei.category.itemInformation": "Information",
"gui.jei.category.tagInformation": "%s Tags",
"gui.jei.category.recipe.crashed": "This recipe crashed. Please see client logs for details.",
"gui.jei.category.tagInformation.block": "Block Tags",
"gui.jei.category.tagInformation.fluid": "Fluid Tags",
"gui.jei.category.tagInformation.item": "Item Tags",
"gui.jei.category.recipe.crashed": "This recipe crashed. Please see the client logs for details.",

"_comment": "Messages",
"jei.message.configured": "Install the \"Configured\" mod to access the in-game config",
Expand Down
3 changes: 3 additions & 0 deletions Common/src/main/resources/assets/jei/lang/ja_jp.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@
"gui.jei.category.compostable.chance": "確率:%s%%",
"gui.jei.category.itemInformation": "説明",
"gui.jei.category.tagInformation": "%sタグ",
"gui.jei.category.tagInformation.block": "ブロックタグ",
"gui.jei.category.tagInformation.fluid": "流体タグ",
"gui.jei.category.tagInformation.item": "アイテムタグ",

"_comment": "Messages",
"jei.message.configured": "ゲーム内で設定にアクセスするには、\n\"Configured\" Modをインストールしてください",
Expand Down
4 changes: 4 additions & 0 deletions Common/src/main/resources/assets/jei/lang/sv_se.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@
"gui.jei.category.compostable": "Kompostering",
"gui.jei.category.compostable.chance": "Chans: %s %%",
"gui.jei.category.itemInformation": "Information",
"gui.jei.category.tagInformation.block": "Block taggar",
"gui.jei.category.tagInformation.fluid": "Vätska taggar",
"gui.jei.category.tagInformation.item": "Föremål taggar",
"gui.jei.category.tagInformation": "%s taggar",

"_comment": "Messages",
"jei.message.configured": "Installera modden \"Configured\" för att få åtkomst till konfigurationen i spelet",
Expand Down
5 changes: 4 additions & 1 deletion Common/src/main/resources/assets/jei/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,10 @@
"gui.jei.category.compostable": "堆肥",
"gui.jei.category.compostable.chance": "概率:%s%%",
"gui.jei.category.itemInformation": "信息",
"gui.jei.category.tagInformation": "%s标签",
"gui.jei.category.tagInformation.block": "方块 标签",
"gui.jei.category.tagInformation.fluid": "液体 标签",
"gui.jei.category.tagInformation.item": "物品 标签",
"gui.jei.category.tagInformation": "%s 标签",

"_comment": "Messages",
"jei.message.configured": "安装“Configured”模组以访问游戏内配置",
Expand Down
6 changes: 3 additions & 3 deletions Common/src/main/resources/assets/jei/lang/zh_tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@
"gui.jei.category.compostable": "可堆肥",
"gui.jei.category.compostable.chance": "機率:%s%%",
"gui.jei.category.itemInformation": "資訊",
"gui.jei.category.registry.block": "方塊",
"gui.jei.category.registry.item": "物品",
"gui.jei.category.registry.fluid": "流體",
"gui.jei.category.tagInformation.block": "方塊 標籤",
"gui.jei.category.tagInformation.fluid": "流體 標籤",
"gui.jei.category.tagInformation.item": "物品 標籤",
"gui.jei.category.tagInformation": "%s 標籤",

"_comment": "Messages",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import mezz.jei.common.platform.Services;
import mezz.jei.library.util.ResourceLocationUtil;
import net.minecraft.ChatFormatting;
import net.minecraft.locale.Language;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.FormattedText;
import net.minecraft.resources.ResourceLocation;
Expand All @@ -41,11 +42,15 @@ public TagInfoRecipeCategory(IGuiHelper guiHelper, T recipeType, ResourceLocatio
}

private static Component createTitle(ResourceLocation registryLocation) {
Component registryName = Component.translatableWithFallback(
"gui.jei.category.registry." + ResourceLocationUtil.sanitizePath(registryLocation.getPath()),
StringUtils.capitalize(registryLocation.getPath())
);
return Component.translatable("gui.jei.category.tagInformation", registryName);
String registryName = ResourceLocationUtil.sanitizePath(registryLocation.getPath());
String registryNameTranslationKey = "gui.jei.category.tagInformation." + registryName;

Language language = Language.getInstance();
if (language.has(registryNameTranslationKey)) {
return Component.translatable(registryNameTranslationKey);
}

return Component.translatable("gui.jei.category.tagInformation", StringUtils.capitalize(registryLocation.getPath()));
}

@Override
Expand Down

0 comments on commit f3e13fd

Please sign in to comment.