summaryrefslogtreecommitdiff
path: root/gui/lang
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/lang
parentb7f2ff4d991ae068f7834bf8e565f6261bf7fff1 (diff)
downloadturns-72ab1fb4c1bf363f46470816d8b914a78ac493c4.tar.xz
turns-72ab1fb4c1bf363f46470816d8b914a78ac493c4.zip
gui: restructure file layout and apply licenses
Diffstat (limited to 'gui/lang')
-rw-r--r--gui/lang/CMakeLists.txt77
-rw-r--r--gui/lang/de.po (renamed from gui/lang/po/de.po)0
-rw-r--r--gui/lang/de_CH.po (renamed from gui/lang/po/de_CH.po)0
-rw-r--r--gui/lang/en.po (renamed from gui/lang/po/en.po)0
-rw-r--r--gui/lang/include/turns/lang/messages.hpp49
-rw-r--r--gui/lang/tests/intl_test_init.cpp26
-rw-r--r--gui/lang/tests/messages.cpp72
7 files changed, 0 insertions, 224 deletions
diff --git a/gui/lang/CMakeLists.txt b/gui/lang/CMakeLists.txt
deleted file mode 100644
index 1842615..0000000
--- a/gui/lang/CMakeLists.txt
+++ /dev/null
@@ -1,77 +0,0 @@
-set(TRANSLATIONS
- "de"
- "de_CH"
- "en"
-)
-
-foreach(LANG IN LISTS TRANSLATIONS)
- set(BINARY_FILE "${CMAKE_CURRENT_BINARY_DIR}/${LANG}/LC_MESSAGES/turns.mo")
- set(SOURCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/po/${LANG}.po")
-
- list(APPEND TRANSLATION_BINARIES "${BINARY_FILE}")
-
- add_custom_command(OUTPUT "${BINARY_FILE}"
- COMMAND "${GETTEXT_MSGFMT_EXECUTABLE}"
- ARGS
- "-o"
- "${BINARY_FILE}"
- "${SOURCE_FILE}"
- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
- DEPENDS
- "${SOURCE_FILE}"
- COMMENT "Processing translation ${LANG}"
- )
-
- install(FILES "${BINARY_FILE}"
- DESTINATION "${CMAKE_INSTALL_FULL_LOCALEDIR}/${LANG}/LC_MESSAGES"
- )
-endforeach()
-
-add_custom_target("mofiles" DEPENDS ${TRANSLATION_BINARIES})
-
-add_library("lang" INTERFACE)
-
-add_library("turns::lang" ALIAS "lang")
-
-if(TURNS_USE_INSTALLED_TRANSLATIONS)
- target_compile_definitions("lang" INTERFACE
- "LOCALEDIR=\"${CMAKE_INSTALL_FULL_LOCALEDIR}\""
- )
-else()
- target_compile_definitions("lang" INTERFACE
- "LOCALEDIR=\"${CMAKE_CURRENT_BINARY_DIR}\""
- )
-endif()
-
-target_include_directories("lang" INTERFACE
- "include"
-)
-
-add_dependencies("lang" "mofiles")
-
-# Tests
-
-add_executable("lang-tests"
- "tests/intl_test_init.cpp"
-
- "tests/messages.cpp"
-)
-
-target_link_libraries("lang-tests" PRIVATE
- "Catch2::Catch2WithMain"
- "Intl::Intl"
-
- "turns::lang"
-)
-
-target_compile_definitions("lang-tests" PRIVATE
- "TESTLOCALEDIR=\"${CMAKE_CURRENT_BINARY_DIR}\""
-)
-
-enable_coverage("lang-tests")
-
-target_link_options("lang-tests" PRIVATE
- "$<$<AND:$<CXX_COMPILER_ID:GNU,Clang>,$<CONFIG:Debug>>:--coverage>"
-)
-
-catch_discover_tests("lang-tests") \ No newline at end of file
diff --git a/gui/lang/po/de.po b/gui/lang/de.po
index 15c2d72..15c2d72 100644
--- a/gui/lang/po/de.po
+++ b/gui/lang/de.po
diff --git a/gui/lang/po/de_CH.po b/gui/lang/de_CH.po
index e79f91e..e79f91e 100644
--- a/gui/lang/po/de_CH.po
+++ b/gui/lang/de_CH.po
diff --git a/gui/lang/po/en.po b/gui/lang/en.po
index 54df09f..54df09f 100644
--- a/gui/lang/po/en.po
+++ b/gui/lang/en.po
diff --git a/gui/lang/include/turns/lang/messages.hpp b/gui/lang/include/turns/lang/messages.hpp
deleted file mode 100644
index e57fce4..0000000
--- a/gui/lang/include/turns/lang/messages.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef TURNS_LANG_MESSAGES_HPP
-#define TURNS_LANG_MESSAGES_HPP
-
-namespace turns::lang
-{
- auto constexpr static add_participant = "Add participant";
- auto constexpr static cancel = "Cancel";
- auto constexpr static clear = "_Clear";
- auto constexpr static delete_participant = "Delete participant";
- auto constexpr static disposition = "Disposition";
- auto constexpr static disposition_colors = "Disposition Colors";
- auto constexpr static edit_participant = "Edit participant";
- auto constexpr static end_turn_order = "End turn order";
- auto constexpr static finish = "Finish";
- auto constexpr static flow = "Flow";
- auto constexpr static friendly = "Friendly";
- auto constexpr static hostile = "Hostile";
- auto constexpr static main_menu = "Main Menu";
- auto constexpr static mark_as_defeated = "Mark as defeated";
- auto constexpr static name = "Name";
- auto constexpr static new_turn_order_file_name = "New turn order.trns";
- auto constexpr static next_participant = "Next participant";
- auto constexpr static no_active_turn_order = "No active turn order";
- auto constexpr static open = "_Open...";
- auto constexpr static preferences = "Preferences";
- auto constexpr static preferences_mnemonic = "_Preferences";
- auto constexpr static previous_participant = "Previous participant";
- auto constexpr static priority = "Priority";
- auto constexpr static priority_number = "Priority {}";
- auto constexpr static question_clear_turn_order = "Do you want to clear the turn order?";
- auto constexpr static quit = "_Quit";
- auto constexpr static reset = "Reset";
- auto constexpr static round_number = "Round {}";
- auto constexpr static save = "_Save";
- auto constexpr static save_as = "Save as...";
- auto constexpr static saving_failed_format = "Saving failed: {}";
- auto constexpr static secret = "Secret";
- auto constexpr static skip_defeated = "Skip defeated";
- auto constexpr static start_turn_order = "Start turn order";
- auto constexpr static stop = "Stop";
- auto constexpr static stop_and_clear = "Stop and clear";
- auto constexpr static stop_turn_order = "Stop turn order";
- auto constexpr static successfully_opened_format = "Successfully opened '{}'";
- auto constexpr static successfully_saved_format = "Successfully saved '{}'";
- auto constexpr static turns = "Turns";
- auto constexpr static turns_files = "Turns Files";
-} // namespace turns::lang
-
-#endif \ No newline at end of file
diff --git a/gui/lang/tests/intl_test_init.cpp b/gui/lang/tests/intl_test_init.cpp
deleted file mode 100644
index 5438179..0000000
--- a/gui/lang/tests/intl_test_init.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <catch2/reporters/catch_reporter_event_listener.hpp>
-#include <catch2/reporters/catch_reporter_registrars.hpp>
-
-#include <libintl.h>
-
-#include <clocale>
-
-namespace turns::lang::tests
-{
-
- struct intl_test_init : Catch::EventListenerBase
- {
- using Catch::EventListenerBase::EventListenerBase;
-
- auto testRunStarting(Catch::TestRunInfo const &) -> void override
- {
- setlocale(LC_ALL, "");
- bindtextdomain("turns", TESTLOCALEDIR);
- bind_textdomain_codeset("turns", "UTF-8");
- textdomain("turns");
- }
- };
-
- CATCH_REGISTER_LISTENER(intl_test_init);
-
-} // namespace turns::lang::tests \ No newline at end of file
diff --git a/gui/lang/tests/messages.cpp b/gui/lang/tests/messages.cpp
deleted file mode 100644
index cecb038..0000000
--- a/gui/lang/tests/messages.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-#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