Files
MagicSetEditor2/src/data/localized_string.hpp
T
GenevensiS 436c437189 add compiler directives
add compiler directives
2025-12-30 01:18:04 +01:00

38 lines
1.3 KiB
C++

//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make card games |
//| Copyright: (C) Twan van Laarhoven and the other MSE developers |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#pragma once
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
class Locale;
// ----------------------------------------------------------------------------- : LocalizedString
/// Translations of a text in a template
class LocalizedString {
public:
String default_; //< Value in all other locales
unordered_map<String, String> translations;
/// Translate
String const& get(Locale const& locale) const;
String const& get(String const& locale) const;
String const& get() const;
bool empty() const { return default_.empty(); }
};
#define REFLECT_LOCALIZED_N(name, var) \
do { \
handler.handle(name, var.default_); \
handler.handle(_("localized_") name, var.translations); \
} while (0)
#define REFLECT_LOCALIZED(var) REFLECT_LOCALIZED_N(_(#var), var)