You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now, I don't know if this already is possible but I couldn't find any example or documentation stating it is possible.
YACL provides something similar where if you have a enum that doesn't have a translation for it's variants it just uses the enum variant name as a translation instead of the whole translation key.
For example:
Using the enum
public enum Color {
RED,
GREEN,
BLUE
}
would mean Midnightlib would put modid.midnightconfig.enum.Color.X for the option values in the GUI.
When you have alot of variants that you don't bother giving a translation to it would be much better if Midnightlib would put only the variant name as a default. Maybe this could be a toggle like useDefualtName when you specify it as a config entry.
This would instead produce the strings RED, GREEN and BLUE as values showing up in the GUI when cycling through the num option.
Additionally a custom string could be used if you, for example, extend the mojang StringIdentifiable class and implement the asString method. This would enable you to automize the translation process (atleast into a single language) by turning the enum variants in-code name to a more readable string representation. You could for example turn an enum variant such as DARK_BLUE into the string Dark Blue and have that show up in the GUI.
The text was updated successfully, but these errors were encountered:
I could probably just use the enum variable name if no translation is loaded for it. Should be pretty easy and not take too much space. Thanks for this suggestion!
Though I probably won't implement the StringIdentifiable support, as it'd require the use of a lot of reflection, and would probably not be used by that many people.
Now, I don't know if this already is possible but I couldn't find any example or documentation stating it is possible.
YACL provides something similar where if you have a enum that doesn't have a translation for it's variants it just uses the enum variant name as a translation instead of the whole translation key.
For example:
Using the enum
would mean Midnightlib would put
modid.midnightconfig.enum.Color.X
for the option values in the GUI.When you have alot of variants that you don't bother giving a translation to it would be much better if Midnightlib would put only the variant name as a default. Maybe this could be a toggle like
useDefualtName
when you specify it as a config entry.This would instead produce the strings
RED
,GREEN
andBLUE
as values showing up in the GUI when cycling through the num option.Additionally a custom string could be used if you, for example, extend the mojang
StringIdentifiable
class and implement theasString
method. This would enable you to automize the translation process (atleast into a single language) by turning the enum variants in-code name to a more readable string representation. You could for example turn an enum variant such asDARK_BLUE
into the stringDark Blue
and have that show up in the GUI.The text was updated successfully, but these errors were encountered: