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.
|
||||
@ -67,93 +68,113 @@ class LanguageSelection(object):
|
||||
Bible = 0
|
||||
Application = 1
|
||||
English = 2
|
||||
|
||||
Booknames = {
|
||||
u'Gen': translate('BiblesPlugin','Genesis'),
|
||||
u'Exod': translate('BiblesPlugin','Exodus'),
|
||||
u'Lev': translate('BiblesPlugin','Leviticus'),
|
||||
u'Num': translate('BiblesPlugin','Numbers'),
|
||||
u'Deut': translate('BiblesPlugin','Deuteronomy'),
|
||||
u'Josh': translate('BiblesPlugin','Joshua'),
|
||||
u'Judg': translate('BiblesPlugin','Judges'),
|
||||
u'Ruth': translate('BiblesPlugin','Ruth'),
|
||||
u'1Sam': translate('BiblesPlugin','1 Samuel'),
|
||||
u'2Sam': translate('BiblesPlugin','2 Samuel'),
|
||||
u'1Kgs': translate('BiblesPlugin','1 Kings'),
|
||||
u'2Kgs': translate('BiblesPlugin','2 Kings'),
|
||||
u'1Chr': translate('BiblesPlugin','1 Chronicles'),
|
||||
u'2Chr': translate('BiblesPlugin','2 Chronicles'),
|
||||
u'Esra': translate('BiblesPlugin','Ezra'),
|
||||
u'Neh': translate('BiblesPlugin','Nehemiah'),
|
||||
u'Esth': translate('BiblesPlugin','Esther'),
|
||||
u'Job': translate('BiblesPlugin','Job'),
|
||||
u'Ps': translate('BiblesPlugin','Psalms'),
|
||||
u'Prov': translate('BiblesPlugin','Proverbs'),
|
||||
u'Eccl': translate('BiblesPlugin','Ecclesiastes'),
|
||||
u'Song': translate('BiblesPlugin','Song of Solomon'),
|
||||
u'Isa': translate('BiblesPlugin','Isaiah'),
|
||||
u'Jer': translate('BiblesPlugin','Jeremiah'),
|
||||
u'Lam': translate('BiblesPlugin','Lamentations'),
|
||||
u'Ezek': translate('BiblesPlugin','Ezekiel'),
|
||||
u'Dan': translate('BiblesPlugin','Daniel'),
|
||||
u'Hos': translate('BiblesPlugin','Hosea'),
|
||||
u'Joel': translate('BiblesPlugin','Joel'),
|
||||
u'Amos': translate('BiblesPlugin','Amos'),
|
||||
u'Obad': translate('BiblesPlugin','Obadiah'),
|
||||
u'Jonah': translate('BiblesPlugin','Jonah'),
|
||||
u'Mic': translate('BiblesPlugin','Micah'),
|
||||
u'Nah': translate('BiblesPlugin','Nahum'),
|
||||
u'Hab': translate('BiblesPlugin','Habakkuk'),
|
||||
u'Zeph': translate('BiblesPlugin','Zephaniah'),
|
||||
u'Hag': translate('BiblesPlugin','Haggai'),
|
||||
u'Zech': translate('BiblesPlugin','Zechariah'),
|
||||
u'Mal': translate('BiblesPlugin','Malachi'),
|
||||
u'Matt': translate('BiblesPlugin','Matthew'),
|
||||
u'Mark': translate('BiblesPlugin','Mark'),
|
||||
u'Luke': translate('BiblesPlugin','Luke'),
|
||||
u'John': translate('BiblesPlugin','John'),
|
||||
u'Acts': translate('BiblesPlugin','Acts'),
|
||||
u'Rom': translate('BiblesPlugin','Romans'),
|
||||
u'1Cor': translate('BiblesPlugin','1 Corinthians'),
|
||||
u'2Cor': translate('BiblesPlugin','2 Corinthians'),
|
||||
u'Gal': translate('BiblesPlugin','Galatians'),
|
||||
u'Eph': translate('BiblesPlugin','Ephesians'),
|
||||
u'Phil': translate('BiblesPlugin','Philippians'),
|
||||
u'Col': translate('BiblesPlugin','Colossians'),
|
||||
u'1Thess': translate('BiblesPlugin','1 Thessalonians'),
|
||||
u'2Thess': translate('BiblesPlugin','2 Thessalonians'),
|
||||
u'1Tim': translate('BiblesPlugin','1 Timothy'),
|
||||
u'2Tim': translate('BiblesPlugin','2 Timothy'),
|
||||
u'Titus': translate('BiblesPlugin','Titus'),
|
||||
u'Phlm': translate('BiblesPlugin','Philemon'),
|
||||
u'Heb': translate('BiblesPlugin','Hebrews'),
|
||||
u'Jas': translate('BiblesPlugin','James'),
|
||||
u'1Pet': translate('BiblesPlugin','1 Peter'),
|
||||
u'2Pet': translate('BiblesPlugin','2 Peter'),
|
||||
u'1John': translate('BiblesPlugin','1 John'),
|
||||
u'2John': translate('BiblesPlugin','2 John'),
|
||||
u'3John': translate('BiblesPlugin','3 John'),
|
||||
u'Jude': translate('BiblesPlugin','Jude'),
|
||||
u'Rev': translate('BiblesPlugin','Revelation'),
|
||||
u'Jdt': translate('BiblesPlugin','Judith'),
|
||||
u'Wis': translate('BiblesPlugin','Wisdom'),
|
||||
u'Tob': translate('BiblesPlugin','Tobit'),
|
||||
u'Sir': translate('BiblesPlugin','Sirach'),
|
||||
u'Bar': translate('BiblesPlugin','Baruch'),
|
||||
u'1Macc': translate('BiblesPlugin','1 Maccabees'),
|
||||
u'2Macc': translate('BiblesPlugin','2 Maccabees'),
|
||||
u'3Macc': translate('BiblesPlugin','3 Maccabees'),
|
||||
u'4Macc': translate('BiblesPlugin','4 Maccabees'),
|
||||
u'AddDan': translate('BiblesPlugin','Rest of Daniel'),
|
||||
u'AddEsth': translate('BiblesPlugin','Rest of Esther'),
|
||||
u'PrMan': translate('BiblesPlugin','Prayer of Manasses'),
|
||||
u'LetJer': translate('BiblesPlugin','Letter of Jeremiah'),
|
||||
u'PrAza': translate('BiblesPlugin','Prayer of Azariah'),
|
||||
u'Sus': translate('BiblesPlugin','Susanna'),
|
||||
u'Bel': translate('BiblesPlugin','Bel'),
|
||||
u'1Esdr': translate('BiblesPlugin','1 Esdras'),
|
||||
u'2Esdr': translate('BiblesPlugin','2 Esdras')
|
||||
}
|
||||
|
||||
|
||||
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'),
|
||||
u'Num': translate('BiblesPlugin','Numbers'),
|
||||
u'Deut': translate('BiblesPlugin','Deuteronomy'),
|
||||
u'Josh': translate('BiblesPlugin','Joshua'),
|
||||
u'Judg': translate('BiblesPlugin','Judges'),
|
||||
u'Ruth': translate('BiblesPlugin','Ruth'),
|
||||
u'1Sam': translate('BiblesPlugin','1 Samuel'),
|
||||
u'2Sam': translate('BiblesPlugin','2 Samuel'),
|
||||
u'1Kgs': translate('BiblesPlugin','1 Kings'),
|
||||
u'2Kgs': translate('BiblesPlugin','2 Kings'),
|
||||
u'1Chr': translate('BiblesPlugin','1 Chronicles'),
|
||||
u'2Chr': translate('BiblesPlugin','2 Chronicles'),
|
||||
u'Esra': translate('BiblesPlugin','Ezra'),
|
||||
u'Neh': translate('BiblesPlugin','Nehemiah'),
|
||||
u'Esth': translate('BiblesPlugin','Esther'),
|
||||
u'Job': translate('BiblesPlugin','Job'),
|
||||
u'Ps': translate('BiblesPlugin','Psalms'),
|
||||
u'Prov': translate('BiblesPlugin','Proverbs'),
|
||||
u'Eccl': translate('BiblesPlugin','Ecclesiastes'),
|
||||
u'Song': translate('BiblesPlugin','Song of Solomon'),
|
||||
u'Isa': translate('BiblesPlugin','Isaiah'),
|
||||
u'Jer': translate('BiblesPlugin','Jeremiah'),
|
||||
u'Lam': translate('BiblesPlugin','Lamentations'),
|
||||
u'Ezek': translate('BiblesPlugin','Ezekiel'),
|
||||
u'Dan': translate('BiblesPlugin','Daniel'),
|
||||
u'Hos': translate('BiblesPlugin','Hosea'),
|
||||
u'Joel': translate('BiblesPlugin','Joel'),
|
||||
u'Amos': translate('BiblesPlugin','Amos'),
|
||||
u'Obad': translate('BiblesPlugin','Obadiah'),
|
||||
u'Jonah': translate('BiblesPlugin','Jonah'),
|
||||
u'Mic': translate('BiblesPlugin','Micah'),
|
||||
u'Nah': translate('BiblesPlugin','Nahum'),
|
||||
u'Hab': translate('BiblesPlugin','Habakkuk'),
|
||||
u'Zeph': translate('BiblesPlugin','Zephaniah'),
|
||||
u'Hag': translate('BiblesPlugin','Haggai'),
|
||||
u'Zech': translate('BiblesPlugin','Zechariah'),
|
||||
u'Mal': translate('BiblesPlugin','Malachi'),
|
||||
u'Matt': translate('BiblesPlugin','Matthew'),
|
||||
u'Mark': translate('BiblesPlugin','Mark'),
|
||||
u'Luke': translate('BiblesPlugin','Luke'),
|
||||
u'John': translate('BiblesPlugin','John'),
|
||||
u'Acts': translate('BiblesPlugin','Acts'),
|
||||
u'Rom': translate('BiblesPlugin','Romans'),
|
||||
u'1Cor': translate('BiblesPlugin','1 Corinthians'),
|
||||
u'2Cor': translate('BiblesPlugin','2 Corinthians'),
|
||||
u'Gal': translate('BiblesPlugin','Galatians'),
|
||||
u'Eph': translate('BiblesPlugin','Ephesians'),
|
||||
u'Phil': translate('BiblesPlugin','Philippians'),
|
||||
u'Col': translate('BiblesPlugin','Colossians'),
|
||||
u'1Thess': translate('BiblesPlugin','1 Thessalonians'),
|
||||
u'2Thess': translate('BiblesPlugin','2 Thessalonians'),
|
||||
u'1Tim': translate('BiblesPlugin','1 Timothy'),
|
||||
u'2Tim': translate('BiblesPlugin','2 Timothy'),
|
||||
u'Titus': translate('BiblesPlugin','Titus'),
|
||||
u'Phlm': translate('BiblesPlugin','Philemon'),
|
||||
u'Heb': translate('BiblesPlugin','Hebrews'),
|
||||
u'Jas': translate('BiblesPlugin','James'),
|
||||
u'1Pet': translate('BiblesPlugin','1 Peter'),
|
||||
u'2Pet': translate('BiblesPlugin','2 Peter'),
|
||||
u'1John': translate('BiblesPlugin','1 John'),
|
||||
u'2John': translate('BiblesPlugin','2 John'),
|
||||
u'3John': translate('BiblesPlugin','3 John'),
|
||||
u'Jude': translate('BiblesPlugin','Jude'),
|
||||
u'Rev': translate('BiblesPlugin','Revelation'),
|
||||
u'Jdt': translate('BiblesPlugin','Judith'),
|
||||
u'Wis': translate('BiblesPlugin','Wisdom'),
|
||||
u'Tob': translate('BiblesPlugin','Tobit'),
|
||||
u'Sir': translate('BiblesPlugin','Sirach'),
|
||||
u'Bar': translate('BiblesPlugin','Baruch'),
|
||||
u'1Macc': translate('BiblesPlugin','1 Maccabees'),
|
||||
u'2Macc': translate('BiblesPlugin','2 Maccabees'),
|
||||
u'3Macc': translate('BiblesPlugin','3 Maccabees'),
|
||||
u'4Macc': translate('BiblesPlugin','4 Maccabees'),
|
||||
u'AddDan': translate('BiblesPlugin','Rest of Daniel'),
|
||||
u'AddEsth': translate('BiblesPlugin','Rest of Esther'),
|
||||
u'PrMan': translate('BiblesPlugin','Prayer of Manasses'),
|
||||
u'LetJer': translate('BiblesPlugin','Letter of Jeremiah'),
|
||||
u'PrAza': translate('BiblesPlugin','Prayer of Azariah'),
|
||||
u'Sus': translate('BiblesPlugin','Susanna'),
|
||||
u'Bel': translate('BiblesPlugin','Bel'),
|
||||
u'1Esdr': translate('BiblesPlugin','1 Esdras'),
|
||||
u'2Esdr': translate('BiblesPlugin','2 Esdras')
|
||||
}
|
||||
|
||||
|
||||
def update_reference_separators():
|
||||
"""
|
||||
@ -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