Improve empty value checks

This commit is contained in:
Gunter Labes 2022-02-15 19:13:55 +01:00
parent ef2205aa62
commit e8e5387069

View file

@ -2246,11 +2246,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 not 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)