Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import dev.isxander.yacl3.config.v2.impl.autogen.YACLAutoGenException;
import dev.isxander.yacl3.impl.utils.YACLConstants;
import dev.isxander.yacl3.platform.YACLPlatform;
import net.minecraft.locale.Language;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.Identifier;
import org.apache.commons.lang3.Validate;
Expand Down Expand Up @@ -134,8 +135,14 @@ public YetAnotherConfigLib generateGui() {
OptionAddable group = groups.groups().computeIfAbsent(autoGen.group().orElse(""), k -> {
if (k.isEmpty())
return groups.category();
return OptionGroup.createBuilder()
.name(Component.translatable("yacl3.config.%s.category.%s.group.%s".formatted(id().toString(), autoGen.category(), k)));
String groupKey = "yacl3.config.%s.category.%s.group.%s".formatted(id().toString(), autoGen.category(), k);
OptionGroup.Builder groupBuilder = OptionGroup.createBuilder()
.name(Component.translatable(groupKey));
String descriptionKey = groupKey + ".desc";
if (Language.getInstance().has(descriptionKey)) {
groupBuilder.description(OptionDescription.of(Component.translatable(descriptionKey)));
}
return groupBuilder;
});

Option<?> option;
Expand Down
4 changes: 4 additions & 0 deletions src/testmod/resources/assets/yacl_test/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"yacl3.config.yacl3-test:config.category.test.group.master_test": "My group!",
"yacl3.config.yacl3-test:config.category.test.group.master_test.desc": "This group has a description via a translation key."
}