r702: Updated French translation (Vincent Lef�vre).
[rox-filer.git] / ROX-Filer / src / po / tips.py
blobc4fc620b1606c83807da86bbcbb3feaa3426a94b
1 # Grab the tips from Options.xml
3 from xmllib import *
4 import string, os
6 print "Extracting translatable bits from Options.xml..."
8 class Parser(XMLParser):
9 data = ""
11 def unknown_starttag(self, tag, attrs):
12 if attrs.has_key('title'):
13 self.trans(attrs['title'])
14 if attrs.has_key('label'):
15 self.trans(attrs['label'])
16 self.data = ""
18 def handle_data(self, data):
19 self.data = self.data + data
21 def unknown_endtag(self, tag):
22 data = string.strip(self.data)
23 if data:
24 self.trans(data)
26 def trans(self, data):
27 data = string.join(string.split(data, '\n'), '\\n')
28 out.write('_("%s")\n' % data)
30 try:
31 os.chdir("po")
32 except OSError:
33 pass
35 file = open('../../Options.xml', 'rb')
36 out = open('../tips', 'wb')
37 parser = Parser()
38 parser.feed(file.read())
39 file.close()
40 parser.close()
41 out.close()