forked from openlp/openlp
Make user strings more specific and translatable.
This commit is contained in:
parent
0c391385d0
commit
14e9f76304
@ -77,7 +77,4 @@ class OpenLyricsImport(SongImport):
|
|||||||
except OpenLyricsError as exception:
|
except OpenLyricsError as exception:
|
||||||
log.exception(u'OpenLyricsException of type %s: %s in file %s'
|
log.exception(u'OpenLyricsException of type %s: %s in file %s'
|
||||||
% (exception.type, exception.message, file_path))
|
% (exception.type, exception.message, file_path))
|
||||||
if exception.type == 'XML':
|
self.logError(file_path, exception.display_message)
|
||||||
self.logError(file_path, SongStrings.XMLSyntaxError)
|
|
||||||
else:
|
|
||||||
self.logError(file_path, exception.message)
|
|
||||||
|
@ -676,11 +676,17 @@ class OpenLyrics(object):
|
|||||||
try:
|
try:
|
||||||
lyrics = song_xml.lyrics
|
lyrics = song_xml.lyrics
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise OpenLyricsError('XML', 'Missing lyrics item')
|
raise OpenLyricsError('XML', 'Missing lyrics item',
|
||||||
|
unicode(translate('OpenLP.OpenLyricsImportError',
|
||||||
|
'XML tree is missing <lyrics> tag. '
|
||||||
|
'It is not valid OpenLyrics file.')))
|
||||||
try:
|
try:
|
||||||
verses = lyrics.verse
|
verses = lyrics.verse
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise OpenLyricsError('XML', 'Missing verse item')
|
raise OpenLyricsError('XML', 'Missing lyrics item',
|
||||||
|
unicode(translate('OpenLP.OpenLyricsImportError',
|
||||||
|
'XML tree is missing <verse> tag. '
|
||||||
|
'It is not valid OpenLyrics file.')))
|
||||||
# Loop over the "verse" elements.
|
# Loop over the "verse" elements.
|
||||||
for verse in verses:
|
for verse in verses:
|
||||||
text = u''
|
text = u''
|
||||||
@ -804,9 +810,10 @@ class OpenLyricsError(Exception):
|
|||||||
"""
|
"""
|
||||||
By now raised only in case of missing lyrics or verse element in XML.
|
By now raised only in case of missing lyrics or verse element in XML.
|
||||||
"""
|
"""
|
||||||
def __init__(self, exception_type, message):
|
def __init__(self, exception_type, message, display_message):
|
||||||
self.type = exception_type
|
self.type = exception_type
|
||||||
self.message = message
|
self.message = message
|
||||||
|
self.display_message = display_message
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s: %s" % (self.type, self.message)
|
return "%s: %s" % (self.type, self.message)
|
||||||
|
Loading…
Reference in New Issue
Block a user