mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
fcc89b64d6
Added 'trim' and 'remove_tags' script functions; Simplified safety improvements of locale checker; Added 'is_targeted' function to magic game to replace the contains(..) calls git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@635 0fc631ac-6414-0410-93d0-97cfa31319b6
67 lines
2.3 KiB
C++
67 lines
2.3 KiB
C++
//+----------------------------------------------------------------------------+
|
|
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
|
//| Copyright: (C) 2001 - 2007 Twan van Laarhoven |
|
|
//| 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
|
|
String tr(const String& key);
|
|
/// Translate a key with a default value
|
|
String tr(const String& key, const String& def);
|
|
|
|
/// Is this a valid sublocale? Returns errors
|
|
String validate(const String& name, const SubLocaleValidatorP&) const;
|
|
|
|
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 Game specific texts, by game name
|
|
map<String,SubLocaleP> game_translations;
|
|
/// Translations of StyleSheet specific texts, by stylesheet name
|
|
map<String,SubLocaleP> stylesheet_translations;
|
|
/// Translations of SymbolFont specific texts, by symbol font name
|
|
map<String,SubLocaleP> symbol_font_translations;
|
|
|
|
/// Open a locale with the given name
|
|
static LocaleP byName(const String& name);
|
|
|
|
/// Validate that the locale is valid for this MSE version
|
|
virtual void validate(Version = app_version);
|
|
|
|
protected:
|
|
String typeName() const;
|
|
DECLARE_REFLECTION();
|
|
};
|
|
|
|
/// The global locale object
|
|
extern LocaleP the_locale;
|
|
|
|
// ----------------------------------------------------------------------------- : EOF
|
|
#endif
|