1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/*
* SPDX-FileCopyrightText: 2025 Felix Morgner <felix.morgner@gmail.com>
* SPDX-License-Identifier: LGPL-2.1-only
*/
#include "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::messages
{
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::messages
|