~timo-jyrinki/ubuntu-online-tour/fix_1019025

« back to all changes in this revision

Viewing changes to translate-html/translate_html/StringExtractor.py

  • Committer: David Planella
  • Date: 2012-01-20 09:16:13 UTC
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: david.planella@ubuntu.com-20120120091613-4taa4tzpw20a77e8
Renamed the po folder to po-html to allow for a consistent naming if using other translation domains (e.g. if a desktop file is translated with intltool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
JS_FILE = ('application/javascript', None)
39
39
 
40
40
BOM = u'\ufeff'
 
41
PO_FOLDER = translate_htmlconfig.PO_FOLDER
41
42
 
42
43
 
43
44
class HTMLStringParser(HTMLParser):
100
101
        }
101
102
 
102
103
    def _load_files(self):
103
 
        with open(translate_htmlconfig.get_source_file('po',
 
104
        with open(translate_htmlconfig.get_source_file(PO_FOLDER,
104
105
                                                       'POTFILES.in')) as fp:
105
106
            file_list = []
106
107
            for line in fp.readlines():
112
113
 
113
114
    def _save_potfile(self):
114
115
        self.potfile.save(os.path.join(
115
 
                            translate_htmlconfig.get_sources_path(), 'po',
 
116
                            translate_htmlconfig.get_sources_path(),
 
117
                            PO_FOLDER,
116
118
                            'ubuntu-online-tour.pot'))
117
119
 
118
120
    def extract(self):
143
145
                    message = message[1:-2]
144
146
 
145
147
                    entry = polib.POEntry(
146
 
                                comment = var,
147
 
                                occurrences = [(jsfile_rel, linecount)],
148
 
                                msgid = message,
149
 
                                msgstr = u'')
 
148
                                comment=var,
 
149
                                occurrences=[(jsfile_rel, linecount)],
 
150
                                msgid=message,
 
151
                                msgstr=u'')
150
152
                    self.potfile.append(entry)
151
153
 
152
154
 
169
171
 
170
172
                for message in messages:
171
173
                    entry = polib.POEntry(
172
 
                        occurrences = [(htmlfile_rel, 0)],
173
 
                        msgid = message,
174
 
                        msgstr = u'')
 
174
                        occurrences=[(htmlfile_rel, 0)],
 
175
                        msgid=message,
 
176
                        msgstr=u'')
175
177
                    self.potfile.append(entry)
176
178
        except:
177
 
            print_exc(file = stderr)
 
179
            print_exc(file=stderr)
178
180
 
179
181
 
180
182
class StringExtractorNone(object):