TISbackup/doc/check_translation.py
2020-11-20 14:13:27 +01:00

22 lines
776 B
Python

import fnmatch
import os
matches = []
for root, dirnames, filenames in os.walk('source/locale/fr/LC_MESSAGES/'):
for filename in fnmatch.filter(filenames, '*.po'):
filename = os.path.join(root, filename)
matches.append(os.path.join(root, filename))
data = open(filename,'r').readlines()
val = 0
linenumber = 1
for line in data:
if line.startswith('msgstr ""'):
val = 1
continue
if line.strip()=='' and val==1:
print( "empty translation line %s in %s" % (linenumber,filename))
val = 0
if line.startswith('#, fuzzy'):
print ("fuzzy line %s in %s " % (linenumber,filename))
linenumber = linenumber + 1