QuiltMC / quilt-config

Quilt Config (aka "haven king's metadata of madness") is a library designed to facilitate the creation and management of config files.
Apache License 2.0
21 stars 8 forks source link

Add display name and naming scheme metadata #30

Closed anonymous123-code closed 5 months ago

anonymous123-code commented 7 months ago

Since another intention of quilt config is to allow for mods to automatically generate config screens / menus, configs may also need display name metadata.

In order to allow for this, I suggest a @DisplayName and @DisplayNameConvention as well as the corresponding metadata, akin to @SerializedName and @SerializedNameConvention as described in #29 .

In order to allow for translatables, I suggest a translatable parameter which is by default false. The value would need to be handled by the specific implementation, in order to be independent from Minecraft.

ix0rai commented 7 months ago

can you elaborate on display name convention? if it would work similarly to a serialised name convention annotation (automatically converting field names to a readable string), I'm not a fan as it wouldn't support translatable text

anonymous123-code commented 7 months ago

It would be intended as a shortcut to avoid having to use display name/translations on every single variable, if you want translations use displayName

ix0rai commented 7 months ago

I still don't really like that

also, for translations -- I don't think there's any need for a parameter. we can simply have our mod attempt to translate everything, and it'll just naturally ignore names that aren't valid translation keys

anonymous123-code commented 7 months ago

Leaving the parameter theoretically risks collisions, and modders have to add translation keys to be supported.

I don't want to need active support for my mod. In my prototype I currently replace underscores with spaces assuming that the names are formatted in snake case, but quilt config should provide a better API imo. (Which is the reason for the display name convention)

Additionally, if some config values are hidden or smth like that, it might be useful to stay close to the serialized name to minimize difference between the text file and config screen. So translations might not always be wanted. Then, a simple case converter would make stuff easier.