Handle an unknown bible language nicely

This commit is contained in:
Arjan Schrijver 2013-08-21 22:14:11 +02:00
parent 7ba834689d
commit d6746bb76b

View File

@ -148,11 +148,18 @@ class OSISBible(BibleDB):
self.filename) self.filename)
return False return False
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id) book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
custom_translator = LanguageManager.get_translator( bible_language = BiblesResourcesDB.get_language_by_id(language_id)
BiblesResourcesDB.get_language_by_id( if bible_language is not None:
language_id)['code'])[0] # The language of this bible was found, so we can
book_name_localized = unicode(custom_translator.translate( # translate the name of this book
'BiblesPlugin', book_details[u'name'])) custom_translator = LanguageManager.get_translator(
bible_language['code'])[0]
book_name_localized = unicode(custom_translator.translate(
'BiblesPlugin', book_details[u'name']))
else:
# The language of this bible was not found, so we just
# use the English name for this book
book_name_localized = book_details[u'name']
if not db_book or db_book.name != book_name_localized: if not db_book or db_book.name != book_name_localized:
log.debug(u'New book: "%s"' % book_name_localized) log.debug(u'New book: "%s"' % book_name_localized)
db_book = self.create_book( db_book = self.create_book(