gettextify some new lobby strings and add soem tooltips.

tooltips inside a toggle panel don't seem to work though
This commit is contained in:
Tomasz Śniatowski 2009-08-03 14:45:27 +01:00
parent 5e08ac6df4
commit 4a10aec89c
2 changed files with 37 additions and 18 deletions

View file

@ -75,7 +75,7 @@
[/column]
#enddef
#define GAMELISTBOX_BODY_IMAGE ID LABEL
#define GAMELISTBOX_BODY_IMAGE ID LABEL TOOLTIP
[column]
border = "all"
border_size = 1
@ -83,6 +83,7 @@
id = {ID}
definition = "default"
label = {LABEL}
tooltip = {TOOLTIP}
[/image]
[/column]
#enddef
@ -107,7 +108,7 @@
[column]
[grid]
[row]
{GAMELISTBOX_HEADER_LABEL "map" "Games"}
{GAMELISTBOX_HEADER_LABEL "map" _"Games"}
[/row]
[/grid]
[/column]
@ -145,17 +146,17 @@
{GAMELISTBOX_BODY_LABEL "era" "Era"}
{GAMELISTBOX_BODY_LABEL "map_size_text" ""}
{GAMELISTBOX_BODY_LABEL "scenario" ""}
{GAMELISTBOX_BODY_IMAGE "observer_icon" "misc/eye.png"}
{GAMELISTBOX_BODY_IMAGE "needs_password" "misc/key.png"}
{GAMELISTBOX_BODY_IMAGE "use_map_settings" "misc/ums.png"}
{GAMELISTBOX_BODY_IMAGE "reloaded" "misc/reloaded.png"}
{GAMELISTBOX_BODY_IMAGE "no_era" "misc/red-x.png"}
{GAMELISTBOX_BODY_IMAGE "vision_icon" ""}
{GAMELISTBOX_BODY_IMAGE "gold_icon" "themes/gold-t.png"}
{GAMELISTBOX_BODY_IMAGE "observer_icon" "misc/eye.png" ""}
{GAMELISTBOX_BODY_IMAGE "needs_password" "misc/key.png" _"Requires a password to join"}
{GAMELISTBOX_BODY_IMAGE "use_map_settings" "misc/ums.png" _"Use map settings"}
{GAMELISTBOX_BODY_IMAGE "reloaded" "misc/reloaded.png" _"Reloaded game"}
{GAMELISTBOX_BODY_IMAGE "no_era" "misc/red-x.png" _"Unknown era"}
{GAMELISTBOX_BODY_IMAGE "vision_icon" "" ""}
{GAMELISTBOX_BODY_IMAGE "gold_icon" "themes/gold-t.png" _"Gold per village"}
{GAMELISTBOX_BODY_LABEL_TINY "gold_text" "265"}
{GAMELISTBOX_BODY_IMAGE "xp_icon" "themes/units-t.png"}
{GAMELISTBOX_BODY_IMAGE "xp_icon" "themes/units-t.png" _"Experience modifier"}
{GAMELISTBOX_BODY_LABEL_TINY "xp_text" "70%"}
{GAMELISTBOX_BODY_IMAGE "time_limit_icon" "themes/sand-clock-t.png"}
{GAMELISTBOX_BODY_IMAGE "time_limit_icon" "themes/sand-clock-t.png" _"Time limit"}
{GAMELISTBOX_BODY_LABEL_TINY "time_limit_text" ""}
[/row]
[/grid]
@ -282,6 +283,7 @@
id = "player_list_sort_relation"
definition = "icon_small"
icon = "lobby/sort-friend-off.png"
tooltip = _ "Friends first, ignored people last"
[/toggle_button]
[/column]
[column]
@ -289,6 +291,7 @@
id = "player_list_sort_name"
definition = "icon_small"
icon = "lobby/sort-az-off.png"
tooltip = _ "Alphabetically"
[/toggle_button]
[/column]
[/row]
@ -299,10 +302,10 @@
[column]
[scrollbar_panel]
[definition]
{ONE_PLAYERLISTBOX "active_game" "Selected game"}
{ONE_PLAYERLISTBOX "active_room" "Current room"}
{ONE_PLAYERLISTBOX "other_rooms" "Lobby"}
{ONE_PLAYERLISTBOX "other_games" "Other games"}
{ONE_PLAYERLISTBOX "active_game" _"Selected game"}
{ONE_PLAYERLISTBOX "active_room" _"Current room"}
{ONE_PLAYERLISTBOX "other_rooms" _"Lobby"}
{ONE_PLAYERLISTBOX "other_games" _"Other games"}
[/definition]
[/scrollbar_panel]
[/column]
@ -324,7 +327,7 @@
[label]
id = "room"
definition = "default"
label = "Rooms"
label = _ "Rooms"
[/label]
[/column]
[/row]
@ -342,6 +345,7 @@
definition = "default"
id = "pending_messages"
label = "lobby/sort-friend.png"
tooltip = _"Messages waiting"
[/image]
[/column]
[column]

View file

@ -217,7 +217,6 @@ void tlobby_main::add_whisper_received(const std::string& sender, const std::str
}
}
/** inherited form chat_handler */
void tlobby_main::add_chat_room_message_sent(const std::string& room,
const std::string& message)
{
@ -323,6 +322,14 @@ void add_label_data(std::map<std::string, string_map>& map,
map.insert(std::make_pair(key, item));
}
void add_tooltip_data(std::map<std::string, string_map>& map,
const std::string& key, const std::string& label)
{
string_map item;
item["tooltip"] = label;
map.insert(std::make_pair(key, item));
}
void set_visible_if_exists(tgrid* grid, const char* id, bool visible)
{
twidget* w = grid->find_widget(id, false);
@ -363,7 +370,14 @@ void tlobby_main::update_gamelist()
add_label_data(data, "vision_text", game.vision);
add_label_data(data, "time_limit_text", game.time_limit);
add_label_data(data, "status", game.status);
add_label_data(data, "observer_icon", game.observers ? "misc/eye.png" : "misc/no_observer.png");
if (game.observers) {
add_label_data(data, "observer_icon", "misc/eye.png");
add_tooltip_data(data, "observer_icon", _("Observers allowed"));
} else {
add_label_data(data, "observer_icon", "misc/no_observer.png");
add_tooltip_data(data, "observer_icon", _("Observers not allowed"));
}
const char* vision_icon;
if (game.fog) {
if (game.shroud) {
@ -379,6 +393,7 @@ void tlobby_main::update_gamelist()
}
}
add_label_data(data, "vision_icon", vision_icon);
add_tooltip_data(data, "vision_icon", game.vision);
gamelistbox_->add_row(data);
tgrid* grid = gamelistbox_->get_row_grid(gamelistbox_->get_item_count() - 1);