mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
60c392a068
This also removes perl as a build dependency for people who don't want to run the test suite.
57 lines
1.9 KiB
C++
57 lines
1.9 KiB
C++
//+----------------------------------------------------------------------------+
|
|
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
|
//| Copyright: (C) 2001 - 2017 Twan van Laarhoven and Sean Hunt |
|
|
//| License: GNU General Public License 2 or later (see file COPYING) |
|
|
//+----------------------------------------------------------------------------+
|
|
|
|
#ifndef HEADER_DATA_LOCALE
|
|
#define HEADER_DATA_LOCALE
|
|
|
|
// ----------------------------------------------------------------------------- : Includes
|
|
|
|
#include <util/prec.hpp>
|
|
#include <util/locale.hpp>
|
|
#include <util/reflect.hpp>
|
|
#include <util/io/package.hpp>
|
|
|
|
DECLARE_POINTER_TYPE(Locale);
|
|
DECLARE_POINTER_TYPE(SubLocale);
|
|
DECLARE_POINTER_TYPE(SubLocaleValidator);
|
|
|
|
// ----------------------------------------------------------------------------- : Locale class
|
|
|
|
/// Translations of the texts of a game/stylesheet/symbolfont
|
|
class SubLocale : public IntrusivePtrBase<SubLocale> {
|
|
public:
|
|
map<String,String> translations;
|
|
|
|
/// Translate a key, if not found, apply the default function to the key
|
|
String tr(const String& key, DefaultLocaleFun def);
|
|
String tr(const String& subcat, const String& key, DefaultLocaleFun def);
|
|
|
|
DECLARE_REFLECTION();
|
|
};
|
|
|
|
/// A collection of translations of messages
|
|
class Locale : public Packaged {
|
|
public:
|
|
/// Translations of UI strings in each category
|
|
SubLocale translations[LOCALE_CAT_MAX];
|
|
/// Translations of Package specific texts, by relativeFilename
|
|
map<String,SubLocaleP> package_translations;
|
|
|
|
/// Open a locale with the given name
|
|
static LocaleP byName(const String& name);
|
|
|
|
protected:
|
|
String typeName() const;
|
|
Version fileVersion() const;
|
|
DECLARE_REFLECTION();
|
|
};
|
|
|
|
/// The global locale object
|
|
extern LocaleP the_locale;
|
|
|
|
// ----------------------------------------------------------------------------- : EOF
|
|
#endif
|