diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2024-07-12 15:14:20 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2024-07-12 15:14:20 +0200 |
| commit | 44755b2af3e1ea9110735b119e2c7d1538fae46f (patch) | |
| tree | e139e877dd9a6adfb9e80007efce42100de6f103 /lang/tests/translations.cpp | |
| parent | 6527e61ada411787fa9f70b9c619aef499e0bf63 (diff) | |
| download | turns-44755b2af3e1ea9110735b119e2c7d1538fae46f.tar.xz turns-44755b2af3e1ea9110735b119e2c7d1538fae46f.zip | |
lang: add translation tests
Diffstat (limited to 'lang/tests/translations.cpp')
| -rw-r--r-- | lang/tests/translations.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lang/tests/translations.cpp b/lang/tests/translations.cpp new file mode 100644 index 0000000..1bb78a5 --- /dev/null +++ b/lang/tests/translations.cpp @@ -0,0 +1,29 @@ +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> + +#include <libintl.h> + +#include <format> +#include <string> + +TEST_CASE("All supported languages have translations") +{ + auto message = GENERATE( + "Turns", + "Add a participant", + "No active turn-order", + "_Quit" + ); + + auto locale = GENERATE( + "de_CH.UTF-8", + "de_DE.UTF-8", + "de_AT.UTF-8" + ); + + SECTION(std::format("'{}' has a translation in '{}'", message, locale)) + { + setlocale(LC_ALL, locale); + REQUIRE(std::string{gettext(message)} != message); + } +} |
