Use missing_mandatory_wml_tag instead of extra translatable strings

The logic is that the strings included the names of WML tags, but
weren't clear that they were WML tags, and so the tag names are
being translated.

This reverts almost all of the string changes of PR #7600, which
were in commit f5be4cffb7b34fdd2ac875cf0f76fc8db7e23cef, as well
as a few similar strings which weren't in 1.16.x.

(cherry picked from commit fb758041cab9f0d6bc79755668e0ac002bd57975)
This commit is contained in:
Steve Cotton 2024-02-28 11:13:20 +01:00
parent d701f626c9
commit f7038a0b27
26 changed files with 76 additions and 89 deletions

View File

@ -26,7 +26,6 @@
#include "gui/widgets/settings.hpp"
#include "gui/widgets/window.hpp"
#include "wml_exception.hpp"
#include "gettext.hpp"
#include "sound.hpp"
@ -160,10 +159,10 @@ button_definition::resolution::resolution(const config& cfg)
: resolution_definition(cfg)
{
// Note the order should be the same as the enum state_t in button.hpp.
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", _("Missing required state for button")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", _("Missing required state for button")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_pressed", _("Missing required state for button")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_focused", _("Missing required state for button")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", missing_mandatory_wml_tag("button_definition][resolution", "state_enabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", missing_mandatory_wml_tag("button_definition][resolution", "state_disabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_pressed", missing_mandatory_wml_tag("button_definition][resolution", "state_pressed")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_focused", missing_mandatory_wml_tag("button_definition][resolution", "state_focused")));
}
// }---------- BUILDER -----------{

View File

@ -652,10 +652,10 @@ chatbox_definition::chatbox_definition(const config& cfg)
chatbox_definition::resolution::resolution(const config& cfg)
: resolution_definition(cfg), grid()
{
state.emplace_back(VALIDATE_WML_CHILD(cfg, "background", _("Missing required background for chatbox")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "foreground", _("Missing required foreground for chatbox")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "background", missing_mandatory_wml_tag("chatbox_definition][resolution", "background")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "foreground", missing_mandatory_wml_tag("chatbox_definition][resolution", "foreground")));
auto child = VALIDATE_WML_CHILD(cfg, "grid", _("Missing required grid for chatbox"));
auto child = VALIDATE_WML_CHILD(cfg, "grid", missing_mandatory_wml_tag("chatbox_definition][resolution", "grid"));
grid = std::make_shared<builder_grid>(child);
}
// }---------- BUILDER -----------{

View File

@ -110,7 +110,7 @@ builder_drawing::builder_drawing(const config& cfg)
: builder_styled_widget(cfg)
, width(cfg["width"])
, height(cfg["height"])
, draw(VALIDATE_WML_CHILD(cfg, "draw", _("Missing [draw] in drawing")))
, draw(VALIDATE_WML_CHILD(cfg, "draw", missing_mandatory_wml_tag("drawing", "draw")))
{
assert(!draw.empty());
}

View File

@ -21,7 +21,6 @@
#include "gui/core/widget_definition.hpp"
#include "wml_exception.hpp"
#include "gettext.hpp"
namespace gui2
{
@ -125,10 +124,10 @@ horizontal_scrollbar_definition::resolution::resolution(const config& cfg)
"minimum_positioner_length"));
// Note the order should be the same as the enum state_t is scrollbar.hpp.
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", _("Missing required state for horizontal scrollbar")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", _("Missing required state for horizontal scrollbar")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_pressed", _("Missing required state for horizontal scrollbar")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_focused", _("Missing required state for horizontal scrollbar")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", missing_mandatory_wml_tag("horizontal_scrollbar_definition][resolution", "state_enabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", missing_mandatory_wml_tag("horizontal_scrollbar_definition][resolution", "state_disabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_pressed", missing_mandatory_wml_tag("horizontal_scrollbar_definition][resolution", "state_pressed")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_focused", missing_mandatory_wml_tag("horizontal_scrollbar_definition][resolution", "state_focused")));
}
// }---------- BUILDER -----------{

View File

@ -25,7 +25,6 @@
#include "wml_exception.hpp"
#include "gettext.hpp"
#define LOG_SCOPE_HEADER get_control_type() + " [" + id() + "] " + __func__
#define LOG_HEADER LOG_SCOPE_HEADER + ':'
@ -109,7 +108,7 @@ image_definition::resolution::resolution(const config& cfg)
: resolution_definition(cfg)
{
// Note the order should be the same as the enum state_t in image.hpp.
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", _("Missing required state for image control")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", missing_mandatory_wml_tag("image_definition][resolution", "state_enabled")));
}
// }---------- BUILDER -----------{

View File

@ -234,8 +234,8 @@ label_definition::resolution::resolution(const config& cfg)
, link_color(cfg["link_color"].empty() ? color_t::from_hex_string("ffff00") : color_t::from_rgba_string(cfg["link_color"].str()))
{
// Note the order should be the same as the enum state_t is label.hpp.
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", _("Missing required state for text label control")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", _("Missing required state for text label control")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", missing_mandatory_wml_tag("label_definition][resolution", "state_enabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", missing_mandatory_wml_tag("label_definition][resolution", "state_disabled")));
}
// }---------- BUILDER -----------{

View File

@ -704,10 +704,10 @@ listbox_definition::resolution::resolution(const config& cfg)
, grid(nullptr)
{
// Note the order should be the same as the enum state_t in listbox.hpp.
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", _("Missing required state for listbox")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", _("Missing required state for listbox")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", missing_mandatory_wml_tag("listbox_definition][resolution", "state_enabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", missing_mandatory_wml_tag("listbox_definition][resolution", "state_disabled")));
auto child = VALIDATE_WML_CHILD(cfg, "grid", _("No grid defined."));
auto child = VALIDATE_WML_CHILD(cfg, "grid", missing_mandatory_wml_tag("listbox_definition][resolution", "grid"));
grid = std::make_shared<builder_grid>(child);
}

View File

@ -182,11 +182,11 @@ matrix_definition::matrix_definition(const config& cfg)
matrix_definition::resolution::resolution(const config& cfg)
: resolution_definition(cfg)
, content(new builder_grid(VALIDATE_WML_CHILD(cfg, "content", _("Missing [content] in [matrix_definition]"))))
, content(new builder_grid(VALIDATE_WML_CHILD(cfg, "content", missing_mandatory_wml_tag("matrix", "content"))))
{
// Note the order should be the same as the enum state_t in matrix.hpp.
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", _("Missing required state for matrix definition")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", _("Missing required state for matrix definition")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", missing_mandatory_wml_tag("matrix_definition][resolution", "state_enabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", missing_mandatory_wml_tag("matrix_definition][resolution", "state_disabled")));
}
// }---------- BUILDER -----------{
@ -204,7 +204,7 @@ builder_matrix::builder_matrix(const config& cfg)
, builder_bottom(nullptr)
, builder_left(nullptr)
, builder_right(nullptr)
, builder_main(create_widget_builder(VALIDATE_WML_CHILD(cfg, "main", _("Missing [main] in [matrix]"))))
, builder_main(create_widget_builder(VALIDATE_WML_CHILD(cfg, "main", missing_mandatory_wml_tag("matrix", "main"))))
{
if(auto top = cfg.optional_child("top")) {
builder_top = std::make_shared<builder_grid>(*top);

View File

@ -26,7 +26,6 @@
#include "gui/widgets/window.hpp"
#include "sound.hpp"
#include "wml_exception.hpp"
#include "gettext.hpp"
#include <functional>
@ -231,10 +230,10 @@ menu_button_definition::resolution::resolution(const config& cfg)
: resolution_definition(cfg)
{
// Note the order should be the same as the enum state_t in menu_button.hpp.
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", _("Missing required state for menu button")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", _("Missing required state for menu button")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_pressed", _("Missing required state for menu button")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_focused", _("Missing required state for menu button")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", missing_mandatory_wml_tag("menu_button_definition][resolution", "state_enabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", missing_mandatory_wml_tag("menu_button_definition][resolution", "state_disabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_pressed", missing_mandatory_wml_tag("menu_button_definition][resolution", "state_pressed")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_focused", missing_mandatory_wml_tag("menu_button_definition][resolution", "state_focused")));
}
// }---------- BUILDER -----------{

View File

@ -27,7 +27,6 @@
#include "map/exception.hpp"
#include "sdl/rect.hpp"
#include "wml_exception.hpp"
#include "gettext.hpp"
#include "../../minimap.hpp" // We want the file in src/
#include <functional>
@ -112,7 +111,7 @@ minimap_definition::resolution::resolution(const config& cfg)
: resolution_definition(cfg)
{
// Note the order should be the same as the enum state_t in minimap.hpp.
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", _("Missing required state for minimap control")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", missing_mandatory_wml_tag("minimap_definition][resolution", "state_enabled")));
}
// }---------- BUILDER -----------{

View File

@ -463,10 +463,10 @@ multiline_text_definition::resolution::resolution(const config& cfg)
, text_y_offset(cfg["text_y_offset"])
{
// Note the order should be the same as the enum state_t in multiline_text.hpp.
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", _("Missing required state for editable text box")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", _("Missing required state for editable text box")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_focused", _("Missing required state for editable text box")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_hovered", _("Missing required state for editable text box")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", missing_mandatory_wml_tag("multiline_text_definition][resolution", "state_enabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", missing_mandatory_wml_tag("multiline_text_definition][resolution", "state_disabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_focused", missing_mandatory_wml_tag("multiline_text_definition][resolution", "state_focused")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_hovered", missing_mandatory_wml_tag("multiline_text_definition][resolution", "state_hovered")));
}
// }---------- BUILDER -----------{

View File

@ -249,10 +249,10 @@ multimenu_button_definition::resolution::resolution(const config& cfg)
: resolution_definition(cfg)
{
// Note the order should be the same as the enum state_t in multimenu_button.hpp.
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", _("Missing required state for multimenu button")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", _("Missing required state for multimenu button")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_pressed", _("Missing required state for multimenu button")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_focused", _("Missing required state for multimenu button")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", missing_mandatory_wml_tag("multimenu_button_definition][resolution", "state_enabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", missing_mandatory_wml_tag("multimenu_button_definition][resolution", "state_disabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_pressed", missing_mandatory_wml_tag("multimenu_button_definition][resolution", "state_pressed")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_focused", missing_mandatory_wml_tag("multimenu_button_definition][resolution", "state_focused")));
}
// }---------- BUILDER -----------{

View File

@ -358,7 +358,7 @@ builder_pane::builder_pane(const config& cfg)
: builder_widget(cfg)
, grow_dir(*grow_direction::get_enum(cfg["grow_direction"].str()))
, parallel_items(cfg["parallel_items"])
, item_definition(new builder_grid(VALIDATE_WML_CHILD(cfg, "item_definition", _("Missing [item_definition] in [pane]"))))
, item_definition(new builder_grid(VALIDATE_WML_CHILD(cfg, "item_definition", missing_mandatory_wml_tag("pane", "item_definition"))))
{
VALIDATE(parallel_items > 0, _("Need at least 1 parallel item."));
}

View File

@ -116,8 +116,8 @@ panel_definition::resolution::resolution(const config& cfg)
, right_border(cfg["right_border"])
{
// The panel needs to know the order.
state.emplace_back(VALIDATE_WML_CHILD(cfg, "background", _("Missing required background for panel definition")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "foreground", _("Missing required foreground for panel definition")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "background", missing_mandatory_wml_tag("panel_definition][resolution", "background")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "foreground", missing_mandatory_wml_tag("panel_definition][resolution", "foreground")));
}
// }---------- BUILDER -----------{

View File

@ -21,7 +21,6 @@
#include "gui/core/register_widget.hpp"
#include "gui/widgets/settings.hpp"
#include "wml_exception.hpp"
#include "gettext.hpp"
#include <functional>
@ -93,7 +92,7 @@ progress_bar_definition::resolution::resolution(const config& cfg)
: resolution_definition(cfg)
{
// Note the order should be the same as the enum state_t in progress_bar.hpp.
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", _("Missing required state for progress bar")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", missing_mandatory_wml_tag("progress_bar_definition][resolution", "state_enabled")));
}
// }---------- BUILDER -----------{

View File

@ -24,7 +24,6 @@
#include "gui/widgets/window.hpp"
#include "sound.hpp"
#include "wml_exception.hpp"
#include "gettext.hpp"
#include <functional>
@ -181,10 +180,10 @@ repeating_button_definition::resolution::resolution(const config& cfg)
{
// Note the order should be the same as the enum state_t in
// repeating_button.hpp.
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", _("Missing required state for repeating button")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", _("Missing required state for repeating button")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_pressed", _("Missing required state for repeating button")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_focused", _("Missing required state for repeating button")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", missing_mandatory_wml_tag("repeating_button_definition][resolution", "state_enabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", missing_mandatory_wml_tag("repeating_button_definition][resolution", "state_disabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_pressed", missing_mandatory_wml_tag("repeating_button_definition][resolution", "state_pressed")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_focused", missing_mandatory_wml_tag("repeating_button_definition][resolution", "state_focused")));
}
// }---------- BUILDER -----------{

View File

@ -177,10 +177,10 @@ scroll_label_definition::resolution::resolution(const config& cfg)
: resolution_definition(cfg), grid(nullptr)
{
// Note the order should be the same as the enum state_t is scroll_label.hpp.
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", _("Missing required state for scroll label control")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", _("Missing required state for scroll label control")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", missing_mandatory_wml_tag("scroll_label_definition][resolution", "state_enabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", missing_mandatory_wml_tag("scroll_label_definition][resolution", "state_disabled")));
auto child = VALIDATE_WML_CHILD(cfg, "grid", _("No grid defined for scroll label control"));
auto child = VALIDATE_WML_CHILD(cfg, "grid", missing_mandatory_wml_tag("scroll_label_definition][resolution", "grid"));
grid = std::make_shared<builder_grid>(child);
}

View File

@ -67,10 +67,10 @@ scrollbar_panel_definition::resolution::resolution(const config& cfg)
: resolution_definition(cfg), grid()
{
// The panel needs to know the order.
state.emplace_back(VALIDATE_WML_CHILD(cfg, "background", _("Missing required background for scrollbar panel")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "foreground", _("Missing required foreground for scrollbar panel")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "background", missing_mandatory_wml_tag("scrollbar_panel_definition][resolution", "background")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "foreground", missing_mandatory_wml_tag("scrollbar_panel_definition][resolution", "foreground")));
auto child = VALIDATE_WML_CHILD(cfg, "grid", _("Missing required grid for scrollbar panel"));
auto child = VALIDATE_WML_CHILD(cfg, "grid", missing_mandatory_wml_tag("scrollbar_panel][definition", "grid"));
grid = std::make_shared<builder_grid>(child);
}

View File

@ -310,10 +310,10 @@ slider_definition::resolution::resolution(const config& cfg)
VALIDATE(positioner_length, missing_mandatory_wml_key("resolution", "minimum_positioner_length"));
// Note the order should be the same as the enum state_t is slider.hpp.
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", _("Missing required state for slider")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", _("Missing required state for slider")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_pressed", _("Missing required state for slider")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_focused", _("Missing required state for slider")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", missing_mandatory_wml_tag("slider_definition][resolution", "state_enabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", missing_mandatory_wml_tag("slider_definition][resolution", "state_disabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_pressed", missing_mandatory_wml_tag("slider_definition][resolution", "state_pressed")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_focused", missing_mandatory_wml_tag("slider_definition][resolution", "state_focused")));
}
// }---------- BUILDER -----------{

View File

@ -25,7 +25,6 @@
#include "serialization/unicode.hpp"
#include <functional>
#include "wml_exception.hpp"
#include "gettext.hpp"
#define LOG_SCOPE_HEADER get_control_type() + " [" + id() + "] " + __func__
#define LOG_HEADER LOG_SCOPE_HEADER + ':'
@ -408,10 +407,10 @@ text_box_definition::resolution::resolution(const config& cfg)
, text_y_offset(cfg["text_y_offset"])
{
// Note the order should be the same as the enum state_t in text_box.hpp.
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", _("Missing required state for editable text box")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", _("Missing required state for editable text box")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_focused", _("Missing required state for editable text box")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_hovered", _("Missing required state for editable text box")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", missing_mandatory_wml_tag("text_box_definition][resolution", "state_enabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", missing_mandatory_wml_tag("text_box_definition][resolution", "state_disabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_focused", missing_mandatory_wml_tag("text_box_definition][resolution", "state_focused")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_hovered", missing_mandatory_wml_tag("text_box_definition][resolution", "state_hovered")));
}
// }---------- BUILDER -----------{

View File

@ -24,7 +24,6 @@
#include "gui/core/window_builder/helper.hpp"
#include "sound.hpp"
#include "wml_exception.hpp"
#include "gettext.hpp"
#include <functional>
@ -211,9 +210,9 @@ toggle_button_definition::resolution::resolution(const config& cfg)
// toggle_button.hpp.
for(const auto& c : cfg.child_range("state"))
{
state.emplace_back(VALIDATE_WML_CHILD(c, "enabled", _("Missing required state for toggle button")));
state.emplace_back(VALIDATE_WML_CHILD(c, "disabled", _("Missing required state for toggle button")));
state.emplace_back(VALIDATE_WML_CHILD(c, "focused", _("Missing required state for toggle button")));
state.emplace_back(VALIDATE_WML_CHILD(c, "enabled", missing_mandatory_wml_tag("toggle_button_definition][resolution][state", "enabled")));
state.emplace_back(VALIDATE_WML_CHILD(c, "disabled", missing_mandatory_wml_tag("toggle_button_definition][resolution][state", "disabled")));
state.emplace_back(VALIDATE_WML_CHILD(c, "focused", missing_mandatory_wml_tag("toggle_button_definition][resolution][state", "focused")));
}
}

View File

@ -299,9 +299,9 @@ toggle_panel_definition::resolution::resolution(const config& cfg)
// Note the order should be the same as the enum state_t in toggle_panel.hpp.
for(const auto& c : cfg.child_range("state"))
{
state.emplace_back(VALIDATE_WML_CHILD(c, "enabled", _("Missing required state for toggle panel")));
state.emplace_back(VALIDATE_WML_CHILD(c, "disabled", _("Missing required state for toggle panel")));
state.emplace_back(VALIDATE_WML_CHILD(c, "focused", _("Missing required state for toggle panel")));
state.emplace_back(VALIDATE_WML_CHILD(c, "enabled", missing_mandatory_wml_tag("toggle_panel_definition][resolution][state", "enabled")));
state.emplace_back(VALIDATE_WML_CHILD(c, "disabled", missing_mandatory_wml_tag("toggle_panel_definition][resolution][state", "disabled")));
state.emplace_back(VALIDATE_WML_CHILD(c, "focused", missing_mandatory_wml_tag("toggle_panel_definition][resolution][state", "focused")));
}
}

View File

@ -265,10 +265,10 @@ tree_view_definition::resolution::resolution(const config& cfg)
, grid(nullptr)
{
// Note the order should be the same as the enum state_t is listbox.hpp.
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", _("Missing required state for tree view")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", _("Missing required state for tree view")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", missing_mandatory_wml_tag("tree_view_definition][resolution", "state_enabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", missing_mandatory_wml_tag("tree_view_definition][resolution", "state_disabled")));
auto child = VALIDATE_WML_CHILD(cfg, "grid", _("No grid defined for tree view"));
auto child = VALIDATE_WML_CHILD(cfg, "grid", missing_mandatory_wml_tag("tree_view_definition][resolution", "grid"));
grid = std::make_shared<builder_grid>(child);
}
@ -325,11 +325,8 @@ tree_node::tree_node(const config& cfg)
// TODO: interpolate this value into the error message
VALIDATE(id != tree_view::root_node_id, _("[node]id 'root' is reserved for the implementation."));
auto node_definition = cfg.optional_child("node_definition");
VALIDATE(node_definition, _("No node defined."));
builder = std::make_shared<builder_grid>(*node_definition);
auto node_definition = VALIDATE_WML_CHILD(cfg, "node_definition", missing_mandatory_wml_tag("node", "node_definition"));
builder = std::make_shared<builder_grid>(node_definition);
}
} // namespace implementation

View File

@ -608,10 +608,10 @@ unit_preview_pane_definition::unit_preview_pane_definition(const config& cfg)
unit_preview_pane_definition::resolution::resolution(const config& cfg)
: resolution_definition(cfg), grid()
{
state.emplace_back(VALIDATE_WML_CHILD(cfg, "background", _("Missing required background for unit preview pane")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "foreground", _("Missing required foreground for unit preview pane")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "background", missing_mandatory_wml_tag("unit_preview_pane_definition][resolution", "background")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "foreground", missing_mandatory_wml_tag("unit_preview_pane_definition][resolution", "foreground")));
auto child = VALIDATE_WML_CHILD(cfg, "grid", _("Missing required grid for unit preview pane"));
auto child = VALIDATE_WML_CHILD(cfg, "grid", missing_mandatory_wml_tag("unit_preview_pane_definition][resolution", "grid"));
grid = std::make_shared<builder_grid>(child);
}

View File

@ -19,7 +19,6 @@
#include "gui/core/register_widget.hpp"
#include "gui/widgets/settings.hpp"
#include "wml_exception.hpp"
#include "gettext.hpp"
#include <functional>
@ -120,10 +119,10 @@ vertical_scrollbar_definition::resolution::resolution(const config& cfg)
"minimum_positioner_length"));
// Note the order should be the same as the enum state_t in scrollbar.hpp.
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", _("Missing required state for vertical scrollbar")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", _("Missing required state for vertical scrollbar")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_pressed", _("Missing required state for vertical scrollbar")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_focused", _("Missing required state for vertical scrollbar")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_enabled", missing_mandatory_wml_tag("scrollbar_definition][resolution", "state_enabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_disabled", missing_mandatory_wml_tag("scrollbar_definition][resolution", "state_disabled")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_pressed", missing_mandatory_wml_tag("scrollbar_definition][resolution", "state_pressed")));
state.emplace_back(VALIDATE_WML_CHILD(cfg, "state_focused", missing_mandatory_wml_tag("scrollbar_definition][resolution", "state_focused")));
}
// }---------- BUILDER -----------{

View File

@ -169,7 +169,7 @@ namespace implementation
builder_viewport::builder_viewport(const config& cfg)
: builder_widget(cfg)
, widget_(create_widget_builder(VALIDATE_WML_CHILD(cfg, "widget", _("Missing [widget] in [viewport]"))))
, widget_(create_widget_builder(VALIDATE_WML_CHILD(cfg, "widget", missing_mandatory_wml_tag("viewport", "widget"))))
{
}