Improve translation string

Fixes: https://launchpad.net/bugs/1412234
This commit is contained in:
Phill Ridout 2015-01-20 21:38:34 +00:00
parent de213b0f66
commit 7fda8043f5
4 changed files with 54 additions and 6 deletions

View File

@ -182,7 +182,7 @@ class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties):
title = translate('OpenLP.FirstTimeWizard', 'Network Error') title = translate('OpenLP.FirstTimeWizard', 'Network Error')
msg.setText('{} {}'.format(title, err.code if hasattr(err, 'code') else '')) msg.setText('{} {}'.format(title, err.code if hasattr(err, 'code') else ''))
msg.setInformativeText(translate('OpenLP.FirstTimeWizard', msg.setInformativeText(translate('OpenLP.FirstTimeWizard',
'There was a network error attempting to' 'There was a network error attempting to '
'connect to retrieve initial configuration information')) 'connect to retrieve initial configuration information'))
msg.setStandardButtons(msg.Ok) msg.setStandardButtons(msg.Ok)
ans = msg.exec_() ans = msg.exec_()

View File

@ -602,7 +602,7 @@ class BibleImportForm(OpenLPWizard):
if bible_type == BibleFormat.WebDownload: if bible_type == BibleFormat.WebDownload:
self.progress_label.setText( self.progress_label.setText(
translate('BiblesPlugin.ImportWizardForm', 'Registered Bible. Please note, that verses will be ' translate('BiblesPlugin.ImportWizardForm', 'Registered Bible. Please note, that verses will be '
'downloaded on\ndemand and thus an internet connection is required.')) 'downloaded on demand and thus an internet connection is required.'))
else: else:
self.progress_label.setText(WizardStrings.FinishedImport) self.progress_label.setText(WizardStrings.FinishedImport)
else: else:

View File

@ -175,10 +175,32 @@ def update_reference_separators():
""" """
Updates separators and matches for parsing and formating scripture references. Updates separators and matches for parsing and formating scripture references.
""" """
default_separators = \ default_separators = ['|'.join([translate('BiblesPlugin', ':',
translate('BiblesPlugin', 'Verse identifier e.g. Genisis 1 : 1 = Genisis Chapter 1 Verse 1'),
':|v|V|verse|verses;;-|to;;,|and;;end Double-semicolon delimited separators for parsing references. ' translate('BiblesPlugin', 'v',
'Consult the developers for further information.').split(';;') 'Verse identifier e.g. Genisis 1 v 1 = Genisis Chapter 1 Verse 1'),
translate('BiblesPlugin', 'V',
'Verse identifier e.g. Genisis 1 V 1 = Genisis Chapter 1 Verse 1'),
translate('BiblesPlugin', 'verse',
'Verse identifier e.g. Genisis 1 verse 1 = Genisis Chapter 1 Verse 1'),
translate('BiblesPlugin', 'verses',
'Verse identifier e.g. Genisis 1 verses 1 - 2 = '
'Genisis Chapter 1 Verses 1 to 2')]),
'|'.join([translate('BiblesPlugin', '-',
'range identifier e.g. Genisis 1 verse 1 - 2 = '
'Genisis Chapter 1 Verses 1 To 2'),
translate('BiblesPlugin', 'to',
'range identifier e.g. Genisis 1 verse 1 - 2 = '
'Genisis Chapter 1 Verses 1 To 2')]),
'|'.join([translate('BiblesPlugin', ',',
'connecting identifier e.g. Genisis 1 verse 1 - 2, 4 - 5 = '
'Genisis Chapter 1 Verses 1 To 2 And Verses 4 To 5'),
translate('BiblesPlugin', 'and',
'connecting identifier e.g. Genisis 1 verse 1 - 2 and 4 - 5 = '
'Genisis Chapter 1 Verses 1 To 2 And Verses 4 To 5')]),
'|'.join([translate('BiblesPlugin', 'end',
'ending identifier e.g. Genisis 1 verse 1 - end = '
'Genisis Chapter 1 Verses 1 To The Last Verse')])]
settings = Settings() settings = Settings()
settings.beginGroup('bibles') settings.beginGroup('bibles')
custom_separators = [ custom_separators = [

View File

@ -24,13 +24,39 @@ This module contains tests for the lib submodule of the Bibles plugin.
""" """
from unittest import TestCase from unittest import TestCase
from openlp.plugins.bibles import lib
from openlp.plugins.bibles.lib import SearchResults from openlp.plugins.bibles.lib import SearchResults
from tests.functional import MagicMock, patch
class TestLib(TestCase): class TestLib(TestCase):
""" """
Test the functions in the :mod:`lib` module. Test the functions in the :mod:`lib` module.
""" """
def get_reference_separator_test(self):
"""
Test the get_reference_separator method
"""
# GIVEN: A list of expected separators
separators = {'sep_r': '\\s*(?:e)\\s*', 'sep_e_default': 'end', 'sep_v_display': 'w', 'sep_l_display': 'r',
'sep_v_default': ':|v|V|verse|verses', 'sep_l': '\\s*(?:r)\\s*', 'sep_l_default': ',|and',
'sep_e': '\\s*(?:t)\\s*', 'sep_v': '\\s*(?:w)\\s*', 'sep_r_display': 'e',
'sep_r_default': '-|to'}
def side_effect():
lib.REFERENCE_SEPARATORS = separators
with patch('openlp.plugins.bibles.lib.update_reference_separators',
**{'side_effect': side_effect}) as mocked_update_reference_separators:
# WHEN: Calling get_reference_separator
for key, value in separators.items():
ret = lib.get_reference_separator(key)
# THEN: get_reference_separator should return the correct separator
self.assertEqual(separators[key], value)
mocked_update_reference_separators.assert_called_once_with()
def search_results_creation_test(self): def search_results_creation_test(self):
""" """
Test the creation and construction of the SearchResults class Test the creation and construction of the SearchResults class