Sorry, we don't support your browser.  Install a modern browser
This post is closed.

broadcastToAll(message, color), printToAll(message, color) won't work with translated strings#522

J

So here’s what I do:

function onLoad()
    local color = {r = 1, g = 0, b = 0}
    local string = 'string'
    local stringTranslated = '{en}stringTranslated EN{de}stringTranslated DE'

    printToAll('PART 1')
    broadcastToAll('Hello World')
    broadcastToAll(string)
    broadcastToAll(stringTranslated)

    printToAll('PART 2')
    -- works as intended
    broadcastToAll('Hello World', {r = 1, g = 0, b = 0}) 
    broadcastToAll(string, color)

    printToAll('PART 3')
    -- will show up as white
    broadcastToAll('{en}stringTranslated EN{de}stringTranslated DE', {r = 1, g = 0, b = 0})
    broadcastToAll(stringTranslated, {r = 1, g = 0, b = 0})
    broadcastToAll(stringTranslated, color)

    printToAll('PART 4')
    -- works as intended
    printToAll('Hello World', {r = 1, g = 0, b = 0}) 
    printToAll(string, color)

    printToAll('PART 5')
    -- will show up as white
    printToAll('{en}stringTranslated EN{de}stringTranslated DE', {r = 1, g = 0, b = 0})
    printToAll(stringTranslated, {r = 1, g = 0, b = 0})
    printToAll(stringTranslated, color)
end

I expect all messages to be shown in a red color. Most of them don’t, though:
https://imgur.com/hvjb2zt

It seems the color is ignored whenever a string with language codes is to be shown. This happens with both broadcastToAll and printToAll

3 years ago
Changed the status to
Research
3 years ago
Changed the status to
In Progress
2 years ago
Changed the status to
Completed
2 years ago