mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
Added validator for locales based on all strings in the source code.
It checks: - whether all keys used by the program are in the locale - whether the right number of %s are used - if there are no extra keys in the locale that shouldn't be there This will become very useful when translations need to be updated for new MSE versions. There is a perl script for generating the 'expected_locale_keys' resource file. This file contains a list of all the locale keys used. This is a resource and not a data file because it is automatically generated from the code, the user has no business modifying it. I also fixed all the locale errors I found in the process. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@613 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
DECLARE_POINTER_TYPE(Locale);
|
||||
DECLARE_POINTER_TYPE(SubLocale);
|
||||
class SubLocaleValidator;
|
||||
|
||||
// ----------------------------------------------------------------------------- : Locale class
|
||||
|
||||
@@ -29,6 +30,9 @@ class SubLocale : public IntrusivePtrBase<SubLocale> {
|
||||
/// 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 SubLocaleValidator&) const;
|
||||
|
||||
DECLARE_REFLECTION();
|
||||
};
|
||||
|
||||
@@ -47,6 +51,9 @@ 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:
|
||||
String typeName() const;
|
||||
DECLARE_REFLECTION();
|
||||
|
||||
Reference in New Issue
Block a user