mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-27 16:32:20 -07:00
Address review: the card text & images language dropdown listed bare native names, some in inconsistent lowercase (e.g. "čeština", "español de España"), which makes the languages easy to mix up for users that do not read the script (e.g. 日本語 vs 한국어). It now mirrors the UI language dropdown and always pairs the native name with its English name (e.g. "Deutsch (German)", "日本語 (Japanese)"), using the same fixed casing.
43 lines
No EOL
1.4 KiB
C++
43 lines
No EOL
1.4 KiB
C++
#ifndef CARD_LOCALIZATION_H
|
|
#define CARD_LOCALIZATION_H
|
|
|
|
#include <QString>
|
|
#include <QStringList>
|
|
|
|
/**
|
|
* @namespace CardLocalization
|
|
* @ingroup Cards
|
|
*
|
|
* @brief Shared language metadata for localized card text and images.
|
|
*
|
|
* Lists the language codes Cockatrice can display localized card data for and
|
|
* provides human-readable names. The list is shared between Oracle (which
|
|
* imports the selected language's card data) and the client settings UI (which
|
|
* offers the language choice).
|
|
*/
|
|
namespace CardLocalization
|
|
{
|
|
/**
|
|
* @brief Language codes for which localized card data can be imported/displayed.
|
|
*
|
|
* Matches the languages Scryfall can serve localized card images for. "en" is
|
|
* always available as the default/fallback and is not listed here.
|
|
*
|
|
* @return The list of supported language codes.
|
|
*/
|
|
[[nodiscard]] const QStringList &supportedLanguages();
|
|
|
|
/**
|
|
* @brief Human-readable name for a language code.
|
|
*
|
|
* Follows the same "native name (English name)" format the UI language list
|
|
* uses (e.g. "日本語 (Japanese)"), so the English fallback is always visible.
|
|
*
|
|
* @param lang Language code (e.g. "de", "ja", "zhs").
|
|
* @return The language's native name with its English name in parentheses, or
|
|
* the code itself if it cannot be resolved.
|
|
*/
|
|
[[nodiscard]] QString languageDisplayName(const QString &lang);
|
|
} // namespace CardLocalization
|
|
|
|
#endif // CARD_LOCALIZATION_H
|