https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90118

--- Comment #7 from Christophe Lyon <clyon at gcc dot gnu.org> ---
(In reply to Roland Illig from comment #5)

> It would be good if the check-internal-format-escaping.py linter would
> actually output what is wrong in the msgid. The number of checks will
> increase as I'm trying to translate the rest of GCC 9, therefore it will
> become more difficult to guess what is wrong with a translation. Ideally
> this linter should follow the GCC guidelines for diagnostics, which are
> described in
> https://gcc.gnu.org/onlinedocs/gccint/Guidelines-for-Diagnostics.html.

Do you mean something like that?
diff --git a/contrib/check-internal-format-escaping.py
b/contrib/check-internal-format-escaping.py
index 9c62586..802dff2 100755
--- a/contrib/check-internal-format-escaping.py
+++ b/contrib/check-internal-format-escaping.py
@@ -53,15 +53,19 @@ for i, l in enumerate(lines):
                 for p in parts:
                     if p.startswith('-'):
                         if len(p) >= 2 and (p[1].isalpha() and p != '-INF'):
-                            print('%s: %s' % (origin, text))
+                            reason = 'Illegal string after "-"'
+                            print('%s: %s: %s' % (origin, reason, text))
                     elif p.startswith('__builtin_'):
-                        print('%s: %s' % (origin, text))
+                        reason = 'Starts with _builtin_'
+                        print('%s: %s: %s' % (origin, reason, text))
                     if re.search("[^%]'", p):
-                        print('%s: %s' % (origin, text))
+                        reason = 'Illegal single quote'
+                        print('%s: %s: %s' % (origin, reason, text))
                     # %< should not be preceded by a non-punctuation
                     # %character.
                     if re.search("[a-zA-Z0-9]%<", p):
-                        print('%s: %s' % (origin, text))
+                        reason = 'Illegal character before %<'
+                        print('%s: %s: %s' % (origin, reason, text))
             j += 1

         origin = None

Reply via email to