summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoïc Guilloux <glx22@users.noreply.github.com>2021-06-29 22:19:24 +0200
committerGitHub <noreply@github.com>2021-06-29 22:19:24 +0200
commitb6fb0203886debf786662b0bbc47c41e0578e905 (patch)
treec8ee8834d87b3c56aeeb70ac5c6ff85ab3bb6338
parent8336d21b2577e02c754cd78f10b4daba3fbe478f (diff)
downloadopenttd-b6fb0203886debf786662b0bbc47c41e0578e905.tar.xz
Change: [strgen] Change warnings for translations into infos (#9406)
Unless invoked with -w, --warning ("print a warning for any untranslated strings") or -t, --todo ("replace any untranslated strings with '<TODO>'"). Eints normally fixes the warnings after a Pull Request, so it is not really useful information for the developer to see as a warning.
-rw-r--r--src/strgen/strgen.cpp6
-rw-r--r--src/strgen/strgen_base.cpp6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp
index 68002cc3f..025f9406d 100644
--- a/src/strgen/strgen.cpp
+++ b/src/strgen/strgen.cpp
@@ -46,7 +46,11 @@ void CDECL strgen_warning(const char *s, ...)
va_start(va, s);
vseprintf(buf, lastof(buf), s, va);
va_end(va);
- fprintf(stderr, LINE_NUM_FMT("warning"), _file, _cur_line, buf);
+ if (_show_todo > 0) {
+ fprintf(stderr, LINE_NUM_FMT("warning"), _file, _cur_line, buf);
+ } else {
+ fprintf(stderr, LINE_NUM_FMT("info"), _file, _cur_line, buf);
+ }
_warnings++;
}
diff --git a/src/strgen/strgen_base.cpp b/src/strgen/strgen_base.cpp
index 9d1346e17..078e0abbf 100644
--- a/src/strgen/strgen_base.cpp
+++ b/src/strgen/strgen_base.cpp
@@ -818,9 +818,13 @@ void StringReader::ParseFile()
char buf[2048];
_warnings = _errors = 0;
- _translation = this->master || this->translation;
+ _translation = this->translation;
_file = this->file;
+ /* Abusing _show_todo to replace "warning" with "info" for translations. */
+ _show_todo &= 3;
+ if (!this->translation) _show_todo |= 4;
+
/* For each new file we parse, reset the genders, and language codes. */
MemSetT(&_lang, 0);
strecpy(_lang.digit_group_separator, ",", lastof(_lang.digit_group_separator));