Improve python script that sets translation authors to be able to process all files at once
This commit is contained in:
parent
d234954e14
commit
8e886b796a
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
# A simple script that adds all authors from transifex, which are
|
# A simple script that adds all authors from transifex, which are
|
||||||
# listed in comments at the beginning of the file, to the
|
# listed in comments at the beginning of the file, to the
|
||||||
# 'translator-credits' translations - where launchpad added them
|
# 'translator-credits' translations - where launchpad added them
|
||||||
@ -19,13 +19,15 @@ import re
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if len(sys.argv)!=2:
|
if len(sys.argv) < 2:
|
||||||
print "Usage: getpo_authors.py PATH_TO_PO_FILE"
|
print "Usage: getpo_authors.py PATH_TO_PO_FILE"
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
f = open(sys.argv[1], "r")
|
for filename in sys.argv[1:]:
|
||||||
|
print("Processing file ", filename)
|
||||||
|
f = open(filename, "r")
|
||||||
if not f:
|
if not f:
|
||||||
print "Can not find", sys.argv[1]
|
print "Can not find", filename
|
||||||
exit
|
exit
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
|
|
||||||
@ -86,8 +88,10 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
|
|
||||||
# Overwrite old file
|
# Overwrite old file
|
||||||
f = open(sys.argv[1], "w")
|
f = open(filename, "w")
|
||||||
for i in lines:
|
for i in lines:
|
||||||
f.write(i)
|
f.write(i)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
print("Done with ", filename)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user