Fixed bug: 1513490

This commit is contained in:
Olli Suutari 2016-10-02 18:51:16 +03:00
parent 4471338a19
commit cff02e6b7a

View File

@ -307,7 +307,6 @@ def expand_tags(text):
text = text.replace(tag['end tag'], tag['end html']) text = text.replace(tag['end tag'], tag['end html'])
return text return text
def create_separated_list(string_list): def create_separated_list(string_list):
""" """
Returns a string that represents a join of a list of strings with a localized separator. This function corresponds Returns a string that represents a join of a list of strings with a localized separator. This function corresponds
@ -318,7 +317,13 @@ def create_separated_list(string_list):
:param string_list: List of unicode strings :param string_list: List of unicode strings
""" """
if LooseVersion(Qt.PYQT_VERSION_STR) >= LooseVersion('4.9') and LooseVersion(Qt.qVersion()) >= LooseVersion('4.8'): if LooseVersion(Qt.PYQT_VERSION_STR) >= LooseVersion('4.9') and LooseVersion(Qt.qVersion()) >= LooseVersion('4.8'):
return QtCore.QLocale().createSeparatedList(string_list) # Separate items with multiple same type creators with ',' and the last with " and ".
and_translated = translate('OpenLP.Ui', 'and')
if len(string_list) > 1:
string_list = ', '.join(string_list[:-1]) + ' ' + and_translated + ' ' + string_list[-1]
else:
string_list = ''.join(string_list)
return string_list
if not string_list: if not string_list:
return '' return ''
elif len(string_list) == 1: elif len(string_list) == 1:
@ -335,7 +340,6 @@ def create_separated_list(string_list):
'Locale list separator: middle') % (string_list[index], merged) 'Locale list separator: middle') % (string_list[index], merged)
return translate('OpenLP.core.lib', '%s, %s', 'Locale list separator: start') % (string_list[0], merged) return translate('OpenLP.core.lib', '%s, %s', 'Locale list separator: start') % (string_list[0], merged)
from .exceptions import ValidationError from .exceptions import ValidationError
from .filedialog import FileDialog from .filedialog import FileDialog
from .screen import ScreenList from .screen import ScreenList