translation tools: detect missing "other" <item> from <plurals>
"other" is the only <item> that is required, or crashes are possible.
This commit is contained in:
parent
6cb3cf1627
commit
f4766a93c5
@ -52,9 +52,14 @@ for d in sorted(glob.glob(os.path.join(resdir, 'values-*'))):
|
|||||||
root.remove(e)
|
root.remove(e)
|
||||||
|
|
||||||
for e in root.findall('.//plurals'):
|
for e in root.findall('.//plurals'):
|
||||||
|
found_other = False
|
||||||
for item in e.findall('item'):
|
for item in e.findall('item'):
|
||||||
if not item.text:
|
if not item.text:
|
||||||
e.remove(item)
|
e.remove(item)
|
||||||
|
elif item.attrib['quantity'] == 'other':
|
||||||
|
found_other = True
|
||||||
|
if not found_other:
|
||||||
|
print(os.path.relpath(str_path) + ': Missing "other" string in', e.attrib['name'])
|
||||||
|
|
||||||
result = re.sub(r' />', r'/>', ElementTree.tostring(root, encoding='utf-8').decode('utf-8'))
|
result = re.sub(r' />', r'/>', ElementTree.tostring(root, encoding='utf-8').decode('utf-8'))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user