mkremins / fanciful

Fancy Bukkit message formatting
MIT License
95 stars 82 forks source link

Support the Minecraft chat protocol's "translate" option #9

Closed mkremins closed 10 years ago

mkremins commented 10 years ago

See this post for details. Basically, we need an API method that allows users to specify "translate" values for message parts and have them be correctly rendered into the final message JSON.

kezz commented 10 years ago

How do you reckon this should be done? With a big Enum of all available translations? Or just some text?

mkremins commented 10 years ago

Allowing translation values to be arbitrary strings seems more feasible than trying to explicitly enumerate all available translations. There's already a whole lot of translations available, and it seems likely that more will be added for every new feature in the core game.

Some more information about translations is available here.

glen3b commented 10 years ago

Not only does it seem likely that more translations can/will be added, according to the post you linked resource packs can specify arbitrary translation key/value pairs, so using a string key seems like the best way to go.

kezz commented 10 years ago

Okay, so strings it is. Does anybody know what happens if you give an invalid translation string though? I mean if it kicks you that could be an issue..

glen3b commented 10 years ago

@Kezz101 From my brief testing in my command testing world (vanilla 1.7.9), it looks like it will just display the translate string if it cannot map it to a value.

Valid language file entry: 2014-06-06_12 41 28

Invalid language file entry: 2014-06-06_12 42 19

kezz commented 10 years ago

@glen3b Sweet. Strings it is!

glen3b commented 10 years ago

@Kezz101 @mkremins I've added support for these in my PR #28, let me know what you think.