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.
This commit is contained in:
Wedge009 2022-11-03 11:16:37 +11:00 committed by GitHub
parent 80b33deb9b
commit 2010ffdbba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2480,9 +2480,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 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' \