git.cweiske.de
/
enigma2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1ac49f8
)
xml2po: allow parsing multiple files or directories at once
author
Andreas Oberritter
<obi@saftware.de>
Tue, 18 Aug 2009 19:43:20 +0000
(21:43 +0200)
committer
Andreas Oberritter
<obi@saftware.de>
Tue, 18 Aug 2009 19:43:20 +0000
(21:43 +0200)
po/xml2po.py
patch
|
blob
|
history
diff --git
a/po/xml2po.py
b/po/xml2po.py
index 8108caeb5c1f667939c98ad8d2ee405eeea5d460..c517517bdee313220518fadcee9ecea922e0eb6a 100755
(executable)
--- a/
po/xml2po.py
+++ b/
po/xml2po.py
@@
-38,24
+38,27
@@
contentHandler = parseXML(attrlist)
parser.setContentHandler(contentHandler)
if not no_comments:
parser.setProperty(property_lexical_handler, contentHandler)
parser.setContentHandler(contentHandler)
if not no_comments:
parser.setProperty(property_lexical_handler, contentHandler)
-dir = os.listdir(sys.argv[1])
-for x in dir:
- if (str(x[-4:]) == ".xml"):
- parser.parse(sys.argv[1] + str(x))
-
-#parser.parse(sys.argv[1])
-
-attrlist = list(attrlist)
-attrlist.sort(key=lambda a: a[0])
-
-for (k,c) in attrlist:
- print
- print '#: ' + sys.argv[1]
- string.replace(k, "\\n", "\"\n\"")
- if c:
- for l in c.split('\n'):
- print "#. ", l
- if str(k) != "":
- print 'msgid "' + str(k) + '"'
- print 'msgstr ""'
+for arg in sys.argv[1:]:
+ if os.path.isdir(arg):
+ for file in os.listdir(arg):
+ if (file.endswith(".xml")):
+ parser.parse(os.path.join(arg, file))
+ else:
+ parser.parse(arg)
+
+ attrlist = list(attrlist)
+ attrlist.sort(key=lambda a: a[0])
+
+ for (k,c) in attrlist:
+ print
+ print '#: ' + arg
+ string.replace(k, "\\n", "\"\n\"")
+ if c:
+ for l in c.split('\n'):
+ print "#. ", l
+ if str(k) != "":
+ print 'msgid "' + str(k) + '"'
+ print 'msgstr ""'
+
+ attrlist = set()