wmllint: Ignore labels for translation if a PNG extension is found (#7079)

* wmllint: Ignore labels for translation if a PNG extension is found.

Resolves #6995.

(cherry picked from commit 2010ffdbba)
This commit is contained in:
Wedge009 2022-11-03 11:16:37 +11:00
parent 74e2ac7e94
commit 495433fae8

View file

@ -2175,9 +2175,12 @@ to be called on their own".format(filename, num))
% (filename, i+1, key))
lines[i] = lines[i].replace("=_","=")
if markcheck and value and not value.startswith("$") and not value.startswith("{") and not re.match(" +", value) and not has_tr_mark and not ("wmllint: ignore" in comment or "wmllint: noconvert" in comment):
print('"%s", line %d: %s needs translation mark' \
% (filename, i+1, key))
lines[i] = lines[i].replace('=', "=_ ", 1)
# [image] sometimes uses label to specify a reference to a PNG file
# so do not mark for translation in those cases
if not (key == 'label' and '.png' in value):
print('"%s", line %d: %s needs translation mark' \
% (filename, i+1, key))
lines[i] = lines[i].replace('=', "=_ ", 1)
nv = sentence_end.sub(" ", value)
if nv != value:
print('"%s", line %d: double space after sentence end' \