summaryrefslogtreecommitdiff
path: root/gui/tests/messages.cpp
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2025-05-24 11:58:39 +0200
committerFelix Morgner <felix.morgner@gmail.com>2025-05-24 11:58:39 +0200
commit72ab1fb4c1bf363f46470816d8b914a78ac493c4 (patch)
tree27349a1bacbab4ea698be35d2d3d9b5184b15ca1 /gui/tests/messages.cpp
parentb7f2ff4d991ae068f7834bf8e565f6261bf7fff1 (diff)
downloadturns-72ab1fb4c1bf363f46470816d8b914a78ac493c4.tar.xz
turns-72ab1fb4c1bf363f46470816d8b914a78ac493c4.zip
gui: restructure file layout and apply licenses
Diffstat (limited to 'gui/tests/messages.cpp')
-rw-r--r--gui/tests/messages.cpp77
1 files changed, 77 insertions, 0 deletions
diff --git a/gui/tests/messages.cpp b/gui/tests/messages.cpp
new file mode 100644
index 0000000..6ff8936
--- /dev/null
+++ b/gui/tests/messages.cpp
@@ -0,0 +1,77 @@
+/*
+ * SPDX-FileCopyrightText: 2025 Felix Morgner <felix.morgner@gmail.com>
+ * SPDX-License-Identifier: LGPL-2.1-only
+ */
+
+#include "turns/lang/messages.hpp"
+
+#include <catch2/catch_test_macros.hpp>
+#include <catch2/generators/catch_generators.hpp>
+
+#include <libintl.h>
+
+#include <clocale>
+#include <format>
+#include <string>
+
+namespace turns::lang::tests
+{
+
+ TEST_CASE("Translated messages")
+ {
+ auto locale = GENERATE("de_CH.UTF-8", "de_DE.UTF-8", "de_AT.UTF-8");
+ setlocale(LC_ALL, locale);
+
+ SECTION(std::format("Locale '{}'", locale))
+ {
+ auto message = GENERATE(add_participant,
+ cancel,
+ clear,
+ delete_participant,
+ disposition,
+ disposition_colors,
+ edit_participant,
+ end_turn_order,
+ finish,
+ flow,
+ friendly,
+ hostile,
+ main_menu,
+ mark_as_defeated,
+ // a better solution is required to test the following entry:
+ // name,
+ new_turn_order_file_name,
+ next_participant,
+ no_active_turn_order,
+ open,
+ preferences,
+ preferences_mnemonic,
+ previous_participant,
+ priority,
+ priority_number,
+ question_clear_turn_order,
+ quit,
+ reset,
+ save,
+ save_as,
+ saving_failed_format,
+ secret,
+ skip_defeated,
+ start_turn_order,
+ stop,
+ stop_and_clear,
+ stop_turn_order,
+ successfully_opened_format,
+ successfully_saved_format,
+ round_number,
+ turns,
+ turns_files);
+
+ SECTION(std::format("has a translation for '{}'", message))
+ {
+ REQUIRE(std::string{gettext(message)} != message);
+ }
+ }
+ }
+
+} // namespace turns::lang::tests \ No newline at end of file