forked from openlp/openlp
change BibleStrings object
This commit is contained in:
parent
c850d4fecd
commit
5391301b97
@ -59,6 +59,7 @@ class DisplayStyle(object):
|
||||
Curly = 2
|
||||
Square = 3
|
||||
|
||||
|
||||
class LanguageSelection(object):
|
||||
"""
|
||||
An enumeration for bible bookname language.
|
||||
@ -68,7 +69,26 @@ class LanguageSelection(object):
|
||||
Application = 1
|
||||
English = 2
|
||||
|
||||
Booknames = {
|
||||
|
||||
class BibleStrings(object):
|
||||
"""
|
||||
Provide standard strings for objects to use.
|
||||
"""
|
||||
__instance__ = None
|
||||
|
||||
def __new__(cls):
|
||||
"""
|
||||
Override the default object creation method to return a single instance.
|
||||
"""
|
||||
if not cls.__instance__:
|
||||
cls.__instance__ = object.__new__(cls)
|
||||
return cls.__instance__
|
||||
|
||||
def __init__(self):
|
||||
"""
|
||||
These strings should need a good reason to be retranslated elsewhere.
|
||||
"""
|
||||
self.Booknames = {
|
||||
u'Gen': translate('BiblesPlugin','Genesis'),
|
||||
u'Exod': translate('BiblesPlugin','Exodus'),
|
||||
u'Lev': translate('BiblesPlugin','Leviticus'),
|
||||
@ -155,6 +175,7 @@ class LanguageSelection(object):
|
||||
u'2Esdr': translate('BiblesPlugin','2 Esdras')
|
||||
}
|
||||
|
||||
|
||||
def update_reference_separators():
|
||||
"""
|
||||
Updates separators and matches for parsing and formating scripture
|
||||
@ -339,7 +360,7 @@ def parse_reference(reference, bible, language_selection, book_ref_id=False):
|
||||
log.debug(u'Matched reference %s' % reference)
|
||||
book = match.group(u'book')
|
||||
if not book_ref_id:
|
||||
booknames = LanguageSelection.Booknames
|
||||
booknames = BibleStrings().Booknames
|
||||
regex_book = re.compile(u'^[1-4]?[\. ]{0,2}%s' % book.lower(),
|
||||
re.UNICODE)
|
||||
if language_selection == LanguageSelection.Bible:
|
||||
|
@ -38,7 +38,7 @@ from openlp.core.lib.ui import UiStrings, add_widget_completer, \
|
||||
find_and_set_in_combo_box, build_icon
|
||||
from openlp.plugins.bibles.forms import BibleImportForm
|
||||
from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \
|
||||
VerseReferenceList, get_reference_separator, LanguageSelection
|
||||
VerseReferenceList, get_reference_separator, LanguageSelection, BibleStrings
|
||||
from openlp.plugins.bibles.lib.db import BiblesResourcesDB
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -428,7 +428,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
language_selection = QtCore.QSettings().value(
|
||||
self.settingsSection + u'/bookname language',
|
||||
QtCore.QVariant(0)).toInt()[0]
|
||||
booknames = LanguageSelection.Booknames
|
||||
booknames = BibleStrings().Booknames
|
||||
for book in book_data:
|
||||
row = self.advancedBookComboBox.count()
|
||||
if language_selection == LanguageSelection.Bible:
|
||||
@ -505,7 +505,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
if language_selection == LanguageSelection.Bible:
|
||||
books = [book.name + u' ' for book in book_data]
|
||||
elif language_selection == LanguageSelection.Application:
|
||||
booknames = LanguageSelection.Booknames
|
||||
booknames = BibleStrings().Booknames
|
||||
for book in book_data:
|
||||
data = BiblesResourcesDB.get_book_by_id(
|
||||
book.book_reference_id)
|
||||
|
Loading…
Reference in New Issue
Block a user