@@ -48,27 +48,29 @@ public CrateSettingsList(Minecraft minecraft, int i, int j, int k, int l, String
4848 this .permissions = new ArrayList <>(ConfigManager .getEffectivePermissions (crateName ));
4949 this .memoryLimits = ConfigManager .getMemoryLimits (crateName );
5050 this .addEntry (new TextEntry (minecraft , this ,
51- "Allocated storage: %s" .formatted (formatBytes (CrateStorage .getSizeOf (crateName )))));
52- this .addEntry (new TextEntry (minecraft , this , "Initial memory in KBs" ));
53- this .addEntry (new NumberEditEntry (minecraft , this , "Initial memory in kilobytes" ,
54- memoryLimits .getLeft ().toString (), s -> {
55- if (s .chars ().noneMatch (Character ::isDigit )) return ;
51+ "ui.gooseboy.settings.allocated" , formatBytes (CrateStorage .getSizeOf (crateName ))));
52+ this .addEntry (new TextEntry (minecraft , this , "ui.gooseboy.settings.initial_memory" ));
53+ this .addEntry (new NumberEditEntry (minecraft , this , "ui.gooseboy.settings.initial_memory" ,
54+ memoryLimits .getLeft ()
55+ .toString (), s -> {
56+ if (s .chars ()
57+ .noneMatch (Character ::isDigit )) return ;
5658 var n = Integer .parseInt (s );
5759 this .memoryLimits = Pair .of (n , this .memoryLimits .getRight ());
5860 }));
59- this .addEntry (new TextEntry (minecraft , this , "Maximum memory in KBs" ));
60- this .addEntry (new NumberEditEntry (minecraft , this , "Max memory in kilobytes" ,
61- memoryLimits .getRight ().toString (), s -> {
62- if (s .chars ().noneMatch (Character ::isDigit )) return ;
61+ this .addEntry (new TextEntry (minecraft , this , "ui.gooseboy.settings.maximum_memory" ));
62+ this .addEntry (new NumberEditEntry (minecraft , this , "ui.gooseboy.settings.maximum_memory" ,
63+ memoryLimits .getRight ()
64+ .toString (), s -> {
65+ if (s .chars ()
66+ .noneMatch (Character ::isDigit )) return ;
6367 var n = Integer .parseInt (s );
6468 this .memoryLimits = Pair .of (this .memoryLimits .getLeft (), n );
6569 }));
66- this .addEntry (new TextEntry (minecraft , this , "Permissions" ));
70+ this .addEntry (new TextEntry (minecraft , this , "ui.gooseboy.settings.permissions" ));
71+
6772 for (GooseboyCrate .Permission permission : GooseboyCrate .Permission .values ()) {
68- String name = permission .name ()
69- .replace ("_" , " " );
70- String title = Character .toUpperCase (name .charAt (0 )) + name .substring (1 )
71- .toLowerCase ();
73+ String title = "ui.gooseboy.settings.permission.%s" .formatted (permission .name ());
7274 this .addEntry (new BooleanEntry (minecraft , this , title , permissions .contains (permission ),
7375 (checkbox , bl ) -> {
7476 if (bl ) {
@@ -110,10 +112,10 @@ public void renderContent(GuiGraphics guiGraphics, int i, int j, boolean bl, flo
110112 public static class TextEntry extends Entry {
111113 private final StringWidget text ;
112114
113- public TextEntry (Minecraft minecraft , CrateSettingsList list , String text ) {
115+ public TextEntry (Minecraft minecraft , CrateSettingsList list , String text , Object ... o ) {
114116 super (minecraft , list , text );
115117 int i = list .getRowWidth () - this .getTextX () - 2 ;
116- Component component = Component .literal (text );
118+ Component component = Component .translatable (text , o );
117119 this .text = new StringWidget (component , minecraft .font );
118120 this .text .setMaxWidth (i );
119121 }
@@ -146,10 +148,10 @@ public static class BooleanEntry extends Entry {
146148 private final Checkbox checkbox ;
147149
148150 public BooleanEntry (Minecraft minecraft , CrateSettingsList list , String text , boolean checked ,
149- Checkbox .OnValueChange callback ) {
151+ Checkbox .OnValueChange callback , Object ... o ) {
150152 super (minecraft , list , text );
151153 checkbox =
152- Checkbox .builder (Component .literal (text ), minecraft .font )
154+ Checkbox .builder (Component .translatable (text , o ), minecraft .font )
153155 .selected (checked )
154156 .onValueChange (callback )
155157 .build ();
@@ -188,11 +190,12 @@ public static class NumberEditEntry extends Entry {
188190 private final EditBox editBox ;
189191
190192 public NumberEditEntry (Minecraft minecraft , CrateSettingsList list , String text , String defaultText ,
191- Consumer <String > responder ) {
193+ Consumer <String > responder , Object ... o ) {
192194 super (minecraft , list , text );
193- editBox = new EditBox (minecraft .font , 0 , 0 , Component .literal (text ));
195+ editBox = new EditBox (minecraft .font , 0 , 0 , Component .translatable (text , o ));
194196 editBox .setValue (defaultText );
195- editBox .setFilter (p -> p .chars ().allMatch (Character ::isDigit ));
197+ editBox .setFilter (p -> p .chars ()
198+ .allMatch (Character ::isDigit ));
196199 editBox .setResponder (responder );
197200 editBox .setCursorPosition (0 );
198201 editBox .setHighlightPos (0 );
0 commit comments