Locale now sneakily also recognizes lines marked as #_ADD

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1101 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-08-08 18:25:47 +00:00
parent 384671b36c
commit 893547aff2
7 changed files with 30 additions and 7 deletions
+14
View File
@@ -25,6 +25,19 @@ DECLARE_TYPEOF(map<String COMMA SubLocaleP>);
// ----------------------------------------------------------------------------- : Locale class
// when reading, ignore "#_ADD" start of line pragmas
typedef void (*ReaderPragmaHandler)(String&);
DECLARE_DYNAMIC_ARG(ReaderPragmaHandler,reader_pragma_handler);
void ignore_add_pragma(String& str) {
if (starts_with(str,_("#_ADD "))) str = str.substr(6);
else if (starts_with(str,_("#_ADD"))) str = str.substr(5);
else if (starts_with(str,_("#_DEL"))) str.clear();
}
// ----------------------------------------------------------------------------- : Locale class
LocaleP the_locale;
String Locale::typeName() const { return _("locale"); }
@@ -36,6 +49,7 @@ LocaleP Locale::byName(const String& name) {
IMPLEMENT_REFLECTION_NO_SCRIPT(Locale) {
REFLECT_BASE(Packaged);
WITH_DYNAMIC_ARG(reader_pragma_handler, ignore_add_pragma);
REFLECT_N("menu", translations[LOCALE_CAT_MENU]);
REFLECT_N("help", translations[LOCALE_CAT_HELP]);
REFLECT_N("tool", translations[LOCALE_CAT_TOOL]);