CubBossa/TinyTranslations

Precompilation

Closed this issue · 1 comments

For now, the framework is limited to parse <gray>{slot}</gray> whenever a style with this nanomessage representation is being used. This is not the most performant way, since static parts of the string are being parsed over and over again.

To reduce redundant parsing, static messages could be cached. Also, maybe self-closing tags could be parsed into "future components" that need applying values to complete. Then, static components around placeholders could be parsed once.

page <page/>/<pages/>
became

text("page ").append(placeholder(String key, Queue<String>)).append(text("/")).append(placeholder(String key, Queue<String>));

Then traverse and for each placeholder insert appropriate value.

MiniMessage is fast enough so that compilation should not be necessary