luanti-org/luanti

`core.colorize` breaks multiline translations

开放

#12,102 创建于 2022年2月26日

 (3 条评论) (0 个反应) (0 位负责人)C++ (2,395 个派生)auto 404
@ Client / Audiovisuals@ TranslationBuggood first issue

仓库指标

星标
 (13,341 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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.

贡献者指南