git.cweiske.de
/
enigma2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update da,lt,pl,es,fi locale
[enigma2.git]
/
po
/
xml2po.py
diff --git
a/po/xml2po.py
b/po/xml2po.py
index 3c6219eac4142d8939cbc6c93f14277dc6595081..8108caeb5c1f667939c98ad8d2ee405eeea5d460 100755
(executable)
--- a/
po/xml2po.py
+++ b/
po/xml2po.py
@@
-4,7
+4,13
@@
import os
import string
from xml.sax import make_parser
from xml.sax.handler import ContentHandler, property_lexical_handler
import string
from xml.sax import make_parser
from xml.sax.handler import ContentHandler, property_lexical_handler
-from _xmlplus.sax.saxlib import LexicalHandler
+try:
+ from _xmlplus.sax.saxlib import LexicalHandler
+ no_comments = False
+except ImportError:
+ class LexicalHandler:
+ pass
+ no_comments = True
class parseXML(ContentHandler, LexicalHandler):
def __init__(self, attrlist):
class parseXML(ContentHandler, LexicalHandler):
def __init__(self, attrlist):
@@
-30,7
+36,8
@@
attrlist = set()
contentHandler = parseXML(attrlist)
parser.setContentHandler(contentHandler)
contentHandler = parseXML(attrlist)
parser.setContentHandler(contentHandler)
-parser.setProperty(property_lexical_handler, 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"):
dir = os.listdir(sys.argv[1])
for x in dir:
if (str(x[-4:]) == ".xml"):
@@
-48,6
+55,7
@@
for (k,c) in attrlist:
if c:
for l in c.split('\n'):
print "#. ", l
if c:
for l in c.split('\n'):
print "#. ", l
- print 'msgid "' + str(k) + '"'
- print 'msgstr ""'
+ if str(k) != "":
+ print 'msgid "' + str(k) + '"'
+ print 'msgstr ""'