#How to use translated text in a paragraph?

1 messages · Page 1 of 1 (latest)

fair flint
#

I want to combine translated text with non translated text
For example i have this key:

book.edit.button=Edit

i can display it using world.sendMessage({translate: "book.edit.button" })
and i will get Edit in chat

I want to sometimes add a prefix to it like the color code §b so it sends a colored Edit in chat, but obviously this doesn't work
world.sendMessage('§b' + {translate: "book.edit.button"})

I can't make a key for each combination of text and prefix i have, how do i achieve this?

fair flint
#

Never Mind, i figured it out, rawtext takes an array of rawMessages

#
world.sendMessage({rawtext: [{text: '§b'}, {translate: 'book.edit.button'}]})
ocean sleet
#

you could also do this

world.sendMessage(["§b", { translate: "book.edit.button" }])
fair flint
#

although, this won't work for other applications like setting a button text