luanti-org/luanti

`core.colorize` breaks multiline translations

Aperta

#12.102 aperta il 26 feb 2022

 (3 commenti) (0 reazioni) (0 assegnatari)C++ (2395 fork)auto 404
@ Client / Audiovisuals@ TranslationBuggood first issue

Metriche repository

Star
 (13.341 stelle)
Metriche merge PR
 (Merge medio 13g 22h) (48 PR mergiate in 30 g)

Descrizione

Minetest version
Minetest 5.5.0dev-c47313db6
Summary

Attempting to use newlines in colored translated text results in an unexpected error. This happens for \n @n, and @\n.

Steps to reproduce

Create a mod with the following code in init.lua:

local S = minetest.get_translator("trans_test")
minetest.register_on_joinplayer(function(player)
    minetest.chat_send_player(player:get_player_name(), minetest.colorize("red", S("Hello@nworld")))
end)

Any variation of text translated then colored or vice versa will cause an error in the chat box if it includes a newline.

Guida contributor