[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gettext] [bug #44098] Check strings for common problems
From: |
Philip Withnall |
Subject: |
[bug-gettext] [bug #44098] Check strings for common problems |
Date: |
Thu, 29 Jan 2015 10:42:41 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0 |
Follow-up Comment #4, bug #44098 (project gettext):
check_unicode_ellipsis(): this seems to check for ellipses only at the end of
lines, whereas they can actually appear anywhere in a multi-sentence
translatable string.
check_no_space_before_ellipsis(): same.
check_unicode_quote() should handle the case of a closing quotation mark
followed by punctuation, rather than just followed by a space.
syntax_check_message(): this could be refactored as an array of checks to
perform, which would make it easier to add new checks in future:
struct {
int enable_flag;
CheckFunc func;
} check_funcs[] = {
{ CHECK_UNICODE_ELLIPSIS, check_unicode_ellipsis },
{ CHECK_NO_SPACE_BEFORE_ELLIPSIS, check_no_space_before_ellipsis },
…
};
for (i = 0; i < sizeof (check_funcs) / sizeof (*check_funcs); i++) {
if (!(checks & check_funcs[i].enable_flag))
continue;
seen_errors += check_funcs[i].func (mp, mp->msgid, msgid_pos,
checks);
if (mp->msgid_plural)
seen_errors += check_funcs[i].func (mp, mp->msgid_plural,
msgid_pos, checks);
}
Overall, this looks great to me, thanks a lot! One thing I think it’s
missing is a way of suppressing errors, so that the warnings can be enabled
unconditionally, but false positives for strings which are actually correct
can be suppressed. How about a per-string tag in the .pot file comments,
similar to the c-format tag — something like
‘suppress-warnings=no-space-before-ellipsis,unicode-quote’?
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?44098>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/