Skip to content

Commit 0f6fd9d

Browse files
committed
Support translations
1 parent 87cd314 commit 0f6fd9d

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

glass-config-api-v3/src/main/java/net/modificationstation/stationapi/api/config/ConfigCategory.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package net.modificationstation.stationapi.api.config;
22

3+
import net.modificationstation.stationapi.api.util.Identifier;
4+
35
import java.lang.annotation.*;
46

57
@Retention(RetentionPolicy.RUNTIME)
@@ -8,13 +10,13 @@
810
public @interface ConfigCategory {
911

1012
/**
11-
* The name you want to have on the button to access your category and at the top while it's open.
13+
* The name you want to have on the button to access your category and at the top while it's open. Supports translation keys.
1214
* @return a string, supports colour codes.
1315
*/
1416
String name();
1517

1618
/**
17-
* The description shown to users in the scroll menu. ~30 chars max is recommended.
19+
* The description shown to users in the scroll menu. ~30 chars max is recommended. Supports translation keys.
1820
* @return a string, supports colour codes.
1921
*/
2022
String description() default "";

glass-config-api-v3/src/main/java/net/modificationstation/stationapi/api/config/ConfigEntry.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
public @interface ConfigEntry {
99

1010
/**
11-
* This should be the visible name that you want users to see in the config GUI.
11+
* This should be the visible name that you want users to see in the config GUI. Supports translation keys.
1212
* @return a string, supports colour codes.
1313
*/
1414
String name();
1515

1616
/**
17-
* The description shown to users in the scroll menu. ~30 chars max is recommended.
17+
* The description shown to users in the scroll menu. ~30 chars max is recommended. Supports translation keys.
1818
* @return a string, supports colour codes.
1919
*/
2020
String description() default "";

glass-config-api-v3/src/main/java/net/modificationstation/stationapi/impl/config/object/ConfigEntryHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import net.fabricmc.api.Environment;
55
import net.minecraft.client.font.TextRenderer;
66
import net.minecraft.client.gui.screen.Screen;
7+
import net.minecraft.client.resource.language.TranslationStorage;
78
import net.modificationstation.stationapi.api.config.DefaultOnVanillaServer;
89
import net.modificationstation.stationapi.api.config.HasDrawable;
910
import net.modificationstation.stationapi.api.config.ConfigEntry;
@@ -30,7 +31,7 @@ public abstract class ConfigEntryHandler<T> extends ConfigHandlerBase {
3031
protected Function<String, List<String>> textValidator;
3132

3233
public ConfigEntryHandler(String id, ConfigEntry configEntry, Field parentField, Object parentObject, boolean multiplayerSynced, T value, T defaultValue) {
33-
super(id, configEntry.name(), configEntry.description(), parentField, parentObject, multiplayerSynced);
34+
super(id, TranslationStorage.getInstance().get(configEntry.name()), TranslationStorage.getInstance().get(configEntry.description()), parentField, parentObject, multiplayerSynced);
3435
this.configEntry = configEntry;
3536
this.value = value;
3637
this.defaultValue = defaultValue;

0 commit comments

Comments
 (0)