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:
Michael Gorven 2009-11-21 15:45:46 +02:00
commit b401179613
3 changed files with 5 additions and 5 deletions

6
openlp-get-strings.py Normal file → Executable file
View 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):

View File

@ -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

View File

@ -1 +1 @@
1.9.0-673
1.9.0-674