/* * SPDX-FileCopyrightText: 2025 Felix Morgner * SPDX-License-Identifier: LGPL-2.1-only */ #include "messages.hpp" #include #include #include #include #include #include #define LABEL(varname) \ std::pair \ { \ #varname, varname \ } namespace Turns::gui::tests { SCENARIO("Text strings are translated") { auto locale = GENERATE("de_CH.UTF-8", "de_DE.UTF-8", "de_AT.UTF-8"); GIVEN(std::format("The locale '{}' is active", locale)) { setlocale(LC_ALL, locale); auto [label, variable] = GENERATE(LABEL(message::add_participant), LABEL(message::cancel), LABEL(message::clear), LABEL(message::delete_participant), LABEL(message::disposition), LABEL(message::disposition_colors), LABEL(message::edit_participant), LABEL(message::end_turn_order), LABEL(message::finish), LABEL(message::flow), LABEL(message::friendly), LABEL(message::hostile), LABEL(message::main_menu), LABEL(message::mark_as_defeated), LABEL(message::name), LABEL(message::new_turn_order_file_name), LABEL(message::next_participant), LABEL(message::no_active_turn_order), LABEL(message::open), LABEL(message::preferences), LABEL(message::preferences_mnemonic), LABEL(message::previous_participant), LABEL(message::priority), LABEL(message::priority_number), LABEL(message::question_clear_turn_order), LABEL(message::quit), LABEL(message::reset), LABEL(message::save), LABEL(message::save_as), LABEL(message::saving_failed_format), LABEL(message::secret), LABEL(message::skip_defeated), LABEL(message::start_turn_order), LABEL(message::stop), LABEL(message::stop_and_clear), LABEL(message::stop_turn_order), LABEL(message::successfully_opened_format), LABEL(message::successfully_saved_format), LABEL(message::round_number), LABEL(message::turns), LABEL(message::turns_files)); THEN(std::format("{} is translated", label)) { /* gettext will return it's argument if there is no translation found in any of the currently active catalogues. Therefore, if no * translation has been found, the pointer comparison will yield true. Otherwise, a different pointer will be returned, indicating that * a translation was found.*/ REQUIRE_FALSE(gettext(variable) == variable); } } } } // namespace Turns::gui::tests