Moved locale validation to a compile time test, instead of a runtime check performed by MSE itself.

This also removes perl as a build dependency for people who don't want to run the test suite.
This commit is contained in:
Twan van Laarhoven
2020-04-18 19:08:35 +02:00
parent 0d38c64e86
commit 60c392a068
7 changed files with 232 additions and 189 deletions
+3 -9
View File
@@ -22,22 +22,19 @@ DECLARE_POINTER_TYPE(SubLocaleValidator);
/// Translations of the texts of a game/stylesheet/symbolfont
class SubLocale : public IntrusivePtrBase<SubLocale> {
public:
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);
/// 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:
public:
/// Translations of UI strings in each category
SubLocale translations[LOCALE_CAT_MAX];
/// Translations of Package specific texts, by relativeFilename
@@ -46,10 +43,7 @@ class Locale : public Packaged {
/// 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:
protected:
String typeName() const;
Version fileVersion() const;
DECLARE_REFLECTION();