From 0d1b35a4009aeb9740e9ff6d60c25238a327f433 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 9 Aug 2009 10:20:09 +0000 Subject: (svn r17129) -Codechange: also let strgen warn if the translation uses STRINGn or RAW_STRING instead of STRING. --- src/strgen/strgen.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/strgen/strgen.cpp') diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp index 167af24f0..032905066 100644 --- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -44,6 +44,7 @@ struct Case { static bool _masterlang; static bool _translated; +static bool _translation; ///< Is the current file actually a translation or not static const char *_file = "(unknown file)"; static int _cur_line; static int _errors, _warnings, _show_todo; @@ -620,14 +621,18 @@ static const CmdStruct *TranslateCmdForCompare(const CmdStruct *a) return FindCmd("STRING", 6); } - if (strcmp(a->cmd, "SKIP") == 0) return NULL; - return a; } static bool CheckCommandsMatch(char *a, char *b, const char *name) { + /* If we're not translating, i.e. we're compiling the base language, + * it is pointless to do all these checks as it'll always be correct. + * After all, all checks are based on the base language. + */ + if (!_translation) return true; + ParsedCommandStruct templ; ParsedCommandStruct lang; bool result = true; @@ -663,9 +668,9 @@ static bool CheckCommandsMatch(char *a, char *b, const char *name) /* if we reach here, all non consumer commands match up. * Check if the non consumer commands match up also. */ for (uint i = 0; i < lengthof(templ.cmd); i++) { - if (TranslateCmdForCompare(templ.cmd[i]) != TranslateCmdForCompare(lang.cmd[i])) { + if (TranslateCmdForCompare(templ.cmd[i]) != lang.cmd[i]) { strgen_warning("%s: Param idx #%d '%s' doesn't match with template command '%s'", name, i, - lang.cmd[i] == NULL ? "" : lang.cmd[i]->cmd, + lang.cmd[i] == NULL ? "" : TranslateCmdForCompare(lang.cmd[i])->cmd, templ.cmd[i] == NULL ? "" : templ.cmd[i]->cmd); result = false; } @@ -801,6 +806,7 @@ static void ParseFile(const char *file, bool english) FILE *in; char buf[2048]; + _translation = strcmp(file, _file) != 0; _file = file; /* For each new file we parse, reset the genders, and language codes */ -- cgit v1.2.3-70-g09d2