luanti-org/luanti

`core.colorize` breaks multiline translations

Open

#12,102 opened on 2022年2月26日

GitHub で見る
 (3 comments) (0 reactions) (0 assignees)C++ (2,395 forks)auto 404
@ Client / Audiovisuals@ TranslationBuggood first issue

Repository metrics

Stars
 (13,341 stars)
PR merge metrics
 (PR metrics pending)

説明

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.

コントリビューターガイド