Use localized chat room names (#2709)
Turns out that a t_string doesn't automatically obtain the correct
translated value. Thus, I'll simply get it by calling
translation::dsgettext() directly. I also changed the translated string to
be used in the tab label as well.
(cherry-picked from commit 395eaf5251
)
This commit is contained in:
parent
a73662c9e9
commit
25e9087304
2 changed files with 11 additions and 6 deletions
|
@ -377,10 +377,10 @@ bool chatbox::room_window_active(const std::string& room)
|
|||
return t.name == room && t.whisper == false;
|
||||
}
|
||||
|
||||
lobby_chat_window* chatbox::room_window_open(const t_string& room, const bool open_new, const bool allow_close)
|
||||
lobby_chat_window* chatbox::room_window_open(const std::string& room, const bool open_new, const bool allow_close)
|
||||
{
|
||||
return find_or_create_window(room.base_str(), false, open_new, allow_close,
|
||||
VGETTEXT("Room <i>“$name”</i> joined", { { "name", room } }));
|
||||
return find_or_create_window(room, false, open_new, allow_close,
|
||||
VGETTEXT("Room <i>“$name”</i> joined", { { "name", translation::dsgettext("wesnoth-lib", room.c_str()) } }));
|
||||
}
|
||||
|
||||
lobby_chat_window* chatbox::whisper_window_open(const std::string& name, bool open_new)
|
||||
|
@ -430,8 +430,14 @@ lobby_chat_window* chatbox::find_or_create_window(const std::string& name,
|
|||
// Add a new room window tab.
|
||||
//
|
||||
data.clear();
|
||||
item.clear();
|
||||
|
||||
if(!whisper) {
|
||||
item["label"] = translation::dsgettext("wesnoth-lib", name.c_str());
|
||||
} else {
|
||||
item["label"] = "<" + name + ">";
|
||||
}
|
||||
|
||||
item["label"] = whisper ? font::escape_text("<" + name + ">") : name;
|
||||
data.emplace("room", item);
|
||||
|
||||
grid& row_grid = roomlistbox_->add_row(data);
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "game_initialization/lobby_data.hpp"
|
||||
#include "game_initialization/lobby_info.hpp"
|
||||
#include "gui/widgets/container_base.hpp"
|
||||
#include "tstring.hpp"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
@ -232,7 +231,7 @@ public:
|
|||
* 'close' button will be disabled.
|
||||
* @return valid ptr if the window was found or added, null otherwise
|
||||
*/
|
||||
lobby_chat_window* room_window_open(const t_string& room,
|
||||
lobby_chat_window* room_window_open(const std::string& room,
|
||||
const bool open_new, const bool allow_close = true);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue