Cockatrice/libcockatrice_card/CMakeLists.txt
Lukas Brübach 8bb2337117 [Client] Show localized card names, texts and pictures
Localization wiring now runs end to end: the oracle importer collects
foreignData for the configured language and the client renders it.

- [Oracle] Import localized names and rules texts for the selected cardLang
  - single-face cards store their foreignData name and full text
  - multi-face (split/adventure/aftermath/prepare) cards collect the joined
    name once and join each face's translated text with the same separator
    as the English merge; an incomplete translation falls back to English;
    the joined text follows the same highest-priority-set policy as the
    single-face path and is only collected when localization is enabled
  - the wizard switching languages re-imports the card database

- [Client] Display localized card info throughout the client
  - card info text/picture widgets and the game board re-render on language
    change
  - pictures resolve cardLang art through Scryfall's named endpoint using the
    localized name, falling back to id-based art when no match exists
  - deck editor keeps canonical English names as card identity (EditRole)
    while showing localized names (DisplayRole), so decks and wire names
    stay stable

- [Card] Add CardLocalization-backed name/text lookup and cards.xml v4
  localization elements with a bounded-size translation cache

- [Tests] Cover oracle foreignData import (incl. multi-face joins, priority
  and fallback paths), XML v4 localization parsing, deck model localized
  display and the language-aware settings default

Existing installations need to re-run Oracle to see translations: localized
data only lands in cards.xml when the Oracle app is started with the
preferred language selected — launch the separate "Oracle" program that
ships with Cockatrice, pick the language in the wizard and let it re-import
the card database.

The client's database cache (cards.xml.cache) is invalidated by the cache
format bump and the source-hash checks, but a cache written before the
re-import can still hold English-only entries (the hash uses file size and
mtime, so a same-size/same-timestamp rewrite may be served as-is); delete
cards.xml.cache and relaunch if no localized names/texts show up after
re-importing.
2026-09-13 03:41:43 +02:00

62 lines
2.2 KiB
CMake

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(HEADERS
libcockatrice/card/card_info.h
libcockatrice/card/card_info_comparator.h
libcockatrice/card/card_localization.h
libcockatrice/card/lazy_properties_hash.h
libcockatrice/card/database/card_database.h
libcockatrice/card/database/card_database_loader.h
libcockatrice/card/database/card_database_manager.h
libcockatrice/card/database/card_database_querier.h
libcockatrice/card/database/parser/card_database_parser.h
libcockatrice/card/database/parser/cockatrice_xml_3.h
libcockatrice/card/database/parser/cockatrice_xml_4.h
libcockatrice/card/import/card_name_normalizer.h
libcockatrice/card/printing/exact_card.h
libcockatrice/card/printing/printing_info.h
libcockatrice/card/set/card_set.h
libcockatrice/card/relation/card_relation.h
)
qt6_wrap_cpp(MOC_SOURCES ${HEADERS})
add_library(
libcockatrice_card STATIC
${MOC_SOURCES}
libcockatrice/card/card_info.cpp
libcockatrice/card/card_info_comparator.cpp
libcockatrice/card/card_localization.cpp
libcockatrice/card/lazy_properties_hash.cpp
libcockatrice/card/database/card_database.cpp
libcockatrice/card/database/card_database_cache.cpp
libcockatrice/card/database/card_database_loader.cpp
libcockatrice/card/database/card_database_manager.cpp
libcockatrice/card/database/card_database_querier.cpp
libcockatrice/card/database/parser/card_database_parser.cpp
libcockatrice/card/database/parser/cockatrice_xml_3.cpp
libcockatrice/card/database/parser/cockatrice_xml_4.cpp
libcockatrice/card/import/card_name_normalizer.cpp
libcockatrice/card/printing/exact_card.cpp
libcockatrice/card/printing/printing_info.cpp
libcockatrice/card/relation/card_relation.cpp
libcockatrice/card/set/card_set.cpp
libcockatrice/card/set/card_set_list.cpp
libcockatrice/card/format/format_legality_rules.cpp
libcockatrice/card/format/format_legality_rules.h
)
target_include_directories(
libcockatrice_card
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC ${CMAKE_SOURCE_DIR}/cockatrice/src/filters
)
target_link_libraries(
libcockatrice_card
PUBLIC libcockatrice_interfaces
PUBLIC libcockatrice_utility
PUBLIC ${QT_CORE_MODULE}
)