Phoenix616 / MineDown

A MarkDown inspired markup library for Minecraft chat components
https://wiki.phoenix616.dev/library/minedown/
MIT License
296 stars 21 forks source link

[Feature Request] Support for TranslatableComponent #18

Open Ghost-chu opened 2 years ago

Ghost-chu commented 2 years ago

Is your feature request related to a problem? Please describe.

MineDown seems doesn't support TranslatableComponent.

Describe the solution you'd like

Foo [TextWillBeReplaced](translation_key=item.minecraft.diamond_sword) Bar.

Preview:

Foo Diamond Sword Bar.

Describe alternatives you've considered

Nope.

Additional context

Nothing.

Phoenix616 commented 2 years ago

Yeah, translation support has been on my todo for a while now but I could never decide on a proper syntax. The one you are suggesting doesn't really make sense to me tbh. as the part inside the square bracket would be pointless to have and the values in the round parentheses is supposed to apply to the value in the square ones, not completely replace it so a different syntax would be better.

The syntax I personally would prefer could be <translationkey>/<translation=translationkey> (arrows aren't used anywhere yet in MineDown so that could work but they are often used for formatting so it might cause false-positives and would require more escaping) or maybe {translationkey} (but curly brackets are already used in some places for the syntax so that's not really ideal either).

Another solution could be to just have it [translation=translationkey] with square brackets but that could cause some confusion I guess?

Ghost-chu commented 2 years ago

$translation_key$ maybe? It't doesn't need too much escape and rare to use.

Also it easy to input, and translation key consist of A-z 0-9 and dots so that mean it actually doesn't need two different char to mark start and end like arrows.

HarvelsX commented 1 year ago

Maybe you should try to deserialize MiniMessage? Markdown in most implementations support HTML.

Phoenix616 commented 1 year ago

Maybe you should try to deserialize MiniMessage? Markdown in most implementations support HTML.

I fail to see what this has to do with this feature request of adding translatable to the MineDown systax.

Also while I never documented it here I pretty much already decided to go with this format: [Fallback text](translation=translation.key with={value1,value2}) which now that fallbacks exist just make sense it would way easier integrate with the whole approach of using the markdown link systax for additional info.