1 # Grab the tips from Options.xml
4 from xml
.sax
.handler
import ContentHandler
7 print "Extracting translatable bits from Options.xml..."
9 class Handler(ContentHandler
):
12 def startElement(self
, tag
, attrs
):
13 for x
in ['title', 'label', 'end', 'unit']:
18 def characters(self
, data
):
19 self
.data
= self
.data
+ data
21 def endElement(self
, tag
):
22 data
= string
.strip(self
.data
)
27 def trans(self
, data
):
28 data
= string
.join(string
.split(data
, '\n'), '\\n')
30 out
.write('_("%s")\n' % data
.replace('"', '\\"'))
37 out
= open('../tips', 'wb')
38 parse('../../Options.xml', Handler())