Improve empty value checks

This commit is contained in:
Gunter Labes 2022-02-16 20:54:09 +01:00 committed by GitHub
parent 6e476296fb
commit f27cbcfaad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2232,11 +2232,11 @@ to be called on their own".format(filename, num))
print('"%s", line %d: %s should be renamed as variation_id and/or marked as translatable' \
% (filename, i+1, key))
elif is_translatable(key):
if markcheck and has_tr_mark and '""' in lines[i]:
if markcheck and has_tr_mark and value:
print('"%s", line %d: %s doesn`t need translation mark (translatable string is empty)' \
% (filename, i+1, key))
lines[i] = lines[i].replace("=_","=")
if markcheck and not value.startswith("$") and not value.startswith("{") and not re.match(" +", value) and not has_tr_mark and '""' not in lines[i] and not ("wmllint: ignore" in comment or "wmllint: noconvert" in comment):
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)