forked from openlp/openlp
Merge get-strings: Improve regex to extract translation strings.
https://code.launchpad.net/~mgorven/openlp/get-strings/+merge/15120 bzr-revno: 674
This commit is contained in:
commit
b401179613
6
openlp-get-strings.py
Normal file → Executable file
6
openlp-get-strings.py
Normal file → Executable file
@ -42,7 +42,7 @@ ts_message = u""" <message>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
"""
|
||||
find_trUtf8 = re.compile(r"trUtf8\(u'([\.:;\\&\w]+)'\)", re.UNICODE)
|
||||
find_trUtf8 = re.compile(r"trUtf8\(u?(['\"])([^\1]+)\1\)", re.UNICODE)
|
||||
strings = {}
|
||||
|
||||
def parse_file(filename):
|
||||
@ -56,9 +56,9 @@ def parse_file(filename):
|
||||
class_name = line[6:line.find(u'(')]
|
||||
continue
|
||||
for match in find_trUtf8.finditer(line):
|
||||
key = u'%s-%s' % (class_name, match.group(1))
|
||||
key = u'%s-%s' % (class_name, match.group(2))
|
||||
if not key in strings:
|
||||
strings[key] = [class_name, filename, line_number, match.group(1)]
|
||||
strings[key] = [class_name, filename, line_number, match.group(2)]
|
||||
file.close()
|
||||
|
||||
def write_file(filename):
|
||||
|
@ -193,7 +193,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
||||
|
||||
def onImageToolButtonClicked(self):
|
||||
filename = QtGui.QFileDialog.getOpenFileName(
|
||||
self, self.trUtf8('Open file'))
|
||||
self, self.trUtf8(u'Open file'))
|
||||
if filename:
|
||||
self.ImageLineEdit.setText(filename)
|
||||
self.theme.background_filename = filename
|
||||
|
@ -1 +1 @@
|
||||
1.9.0-673
|
||||
1.9.0-674
|
||||
|
Loading…
Reference in New Issue
Block a user