+def tabletemplates_l10n(input_files, output, base):
+ '''Generate pot file from lib/tabletemplates '''
+ output = io.open(output, 'w', encoding='utf_8', newline='\n')
+ # only record each item once
+ seen = []
+ for file in input_files:
+ filename = os.path.normpath(os.path.realpath(file)).split(os.sep)[-1]
+ if os.path.isfile(file):
+ if filename[-4:] != ".lyx":
+ continue
+ filename = filename[:-4]
+ if filename[-4:-1] == "_1x":
+ continue
+ if seen.count(filename):
+ continue
+
+ seen.append(filename)
+ if filename != "":
+ print(u'#: %s:%d\nmsgid "%s"\nmsgstr ""\n' % \
+ (relativePath(input_files[0], base), 0, filename.replace('_', ' ')), file=output)
+ output.close()
+
+