xml2po.py for adding strings from the xml-files
[enigma2.git] / po / xml2po.py
1 #!/usr/bin/python
2 import sys
3 from xml.sax import make_parser
4 from xml.sax.handler import ContentHandler
5
6 class parseXML(ContentHandler):
7         def __init__(self):
8                 self.isPointsElement, self.isReboundsElement = 0, 0
9
10         def startElement(self, name, attrs):
11                 if (attrs.has_key('text')):
12                         print
13                         print '#: ' + sys.argv[1]
14                         print 'msgid "' + str(attrs.get('text', "")) + '"'
15                         print 'msgstr ""'
16
17 sys.argv[1]
18
19 parser = make_parser()
20                 
21 contentHandler = parseXML()
22 parser.setContentHandler(contentHandler)
23 parser.parse(sys.argv[1])