mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-23 10:05:10 -07:00
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.
82 lines
3.9 KiB
C++
82 lines
3.9 KiB
C++
#ifndef CARDS_DISPLAY_SETTINGS_H
|
|
#define CARDS_DISPLAY_SETTINGS_H
|
|
|
|
#include "settings_manager.h"
|
|
|
|
#include <libcockatrice/interfaces/interface_cards_display_settings_provider.h>
|
|
|
|
class CardsDisplaySettings : public SettingsManager, public ICardsDisplaySettingsProvider
|
|
{
|
|
Q_OBJECT
|
|
friend class SettingsCache;
|
|
|
|
public:
|
|
[[nodiscard]] bool getDisplayCardNames() const override;
|
|
[[nodiscard]] bool getRoundCardCorners() const override;
|
|
[[nodiscard]] bool getOverrideAllCardArtWithPersonalPreference() const override;
|
|
[[nodiscard]] bool getBumpSetsWithCardsInDeckToTop() const override;
|
|
[[nodiscard]] int getPrintingSelectorSortOrder() const override;
|
|
[[nodiscard]] int getPrintingSelectorCardSize() const override;
|
|
[[nodiscard]] bool getIncludeRebalancedCards() const override;
|
|
[[nodiscard]] bool getPrintingSelectorNavigationButtonsVisible() const override;
|
|
[[nodiscard]] bool getTapAnimation() const override;
|
|
[[nodiscard]] bool getArrowDrawAnimation() const override;
|
|
[[nodiscard]] bool getAutoRotateSidewaysLayoutCards() const override;
|
|
[[nodiscard]] bool getScaleCards() const override;
|
|
[[nodiscard]] int getStackCardOverlapPercent() const override;
|
|
[[nodiscard]] int getCardInfoViewMode() const override;
|
|
[[nodiscard]] int getVisualDeckStorageCardSize() const override;
|
|
[[nodiscard]] int getVisualDatabaseDisplayCardSize() const override;
|
|
[[nodiscard]] int getVisualDeckEditorCardSize() const override;
|
|
[[nodiscard]] int getEDHRecCardSize() const override;
|
|
[[nodiscard]] int getArchidektPreviewSize() const override;
|
|
[[nodiscard]] int getSampleHandSize() const override;
|
|
[[nodiscard]] QString getCardLang() const override;
|
|
|
|
void setDisplayCardNames(bool _displayCardNames);
|
|
void setRoundCardCorners(bool _roundCardCorners);
|
|
void setOverrideAllCardArtWithPersonalPreference(bool _overrideAllCardArt);
|
|
void setBumpSetsWithCardsInDeckToTop(bool _bumpSetsWithCardsInDeckToTop);
|
|
void setPrintingSelectorSortOrder(int _printingSelectorSortOrder);
|
|
void setPrintingSelectorCardSize(int _printingSelectorCardSize);
|
|
void setIncludeRebalancedCards(bool _includeRebalancedCards);
|
|
void setPrintingSelectorNavigationButtonsVisible(bool _navigationButtonsVisible);
|
|
void setTapAnimation(bool _tapAnimation);
|
|
void setArrowDrawAnimation(bool _arrowDrawAnimation);
|
|
void setAutoRotateSidewaysLayoutCards(bool _autoRotateSidewaysLayoutCards);
|
|
void setCardScaling(bool _scaleCards);
|
|
void setStackCardOverlapPercent(int _verticalCardOverlapPercent);
|
|
void setCardInfoViewMode(int _viewMode);
|
|
void setVisualDeckStorageCardSize(int _cardSize);
|
|
void setVisualDatabaseDisplayCardSize(int _cardSize);
|
|
void setVisualDeckEditorCardSize(int _cardSize);
|
|
void setEDHRecCardSize(int _edhrecCardSize);
|
|
void setArchidektPreviewCardSize(int _archidektPreviewCardSize);
|
|
void setSampleHandSize(int _sampleHandSize);
|
|
void setCardLang(const QString &_cardLang);
|
|
|
|
signals:
|
|
void displayCardNamesChanged();
|
|
void roundCardCornersChanged(bool roundCardCorners);
|
|
void overrideAllCardArtWithPersonalPreferenceChanged(bool _overrideAllCardArtWithPersonalPreference);
|
|
void bumpSetsWithCardsInDeckToTopChanged();
|
|
void printingSelectorSortOrderChanged();
|
|
void printingSelectorCardSizeChanged();
|
|
void includeRebalancedCardsChanged(bool _includeRebalancedCards);
|
|
void printingSelectorNavigationButtonsVisibleChanged();
|
|
void visualDeckStorageCardSizeChanged();
|
|
void visualDatabaseDisplayCardSizeChanged();
|
|
void visualDeckEditorCardSizeChanged();
|
|
void edhRecCardSizeChanged();
|
|
void archidektPreviewSizeChanged();
|
|
void sampleHandSizeChanged(int amount);
|
|
void cardLangChanged(const QString &lang);
|
|
|
|
public:
|
|
explicit CardsDisplaySettings(const QString &settingPath, QObject *parent = nullptr);
|
|
|
|
private:
|
|
CardsDisplaySettings(const CardsDisplaySettings & /*other*/);
|
|
};
|
|
|
|
#endif // CARDS_DISPLAY_SETTINGS_H
|