openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #14048
[Merge] lp:~m2j/openlp/i18n into lp:openlp
Meinert Jordan has proposed merging lp:~m2j/openlp/i18n into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
Bug #802166 in OpenLP: "Allow different scripture notations"
https://bugs.launchpad.net/openlp/+bug/802166
For more details, see:
https://code.launchpad.net/~m2j/openlp/i18n/+merge/93489
Displayed listed items are shown more natural type (Jack, René and Maria).
Displaying names in localized lists is possible by QLocale::createSeparatedList(QStringList). As this function is introduced in Qt 4.8 we will not be able to use it in near future. Therefore I implemented the routine by myself according to http://www.unicode.org/reports/tr35/#ListPatterns . I put this information in the function description, that we know about the fact, that we can replace it later with Qts function. This will save four strings for our translators.
--
https://code.launchpad.net/~m2j/openlp/i18n/+merge/93489
Your team OpenLP Core is requested to review the proposed merge of lp:~m2j/openlp/i18n into lp:openlp.
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py 2012-01-29 22:13:51 +0000
+++ openlp/core/lib/__init__.py 2012-02-16 20:41:21 +0000
@@ -318,6 +318,32 @@
except IOError:
pass
+def create_separated_list(stringlist):
+ """
+ Returns a string that represents a join of a list of strings with a
+ localized separator. This function corresponts to
+ QLocale::createSeparatedList which was introduced in Qt 4.8 and implements
+ the algorithm from http://www.unicode.org/reports/tr35/#ListPatterns
+
+ ``stringlist``
+ List of unicode strings
+ """
+ if not stringlist:
+ return u''
+ elif len(stringlist) == 1:
+ return stringlist[0]
+ elif len(stringlist) == 2:
+ return unicode(translate('OpenLP.core.lib', '%1 and %2',
+ 'Locale list separator: 2 items').arg(stringlist[0], stringlist[1]))
+ else:
+ merged = unicode(translate('OpenLP.core.lib', '%1, and %2',
+ u'Locale list separator: end').arg(stringlist[-2], stringlist[-1]))
+ for index in reversed(range(1, len(stringlist) - 2)):
+ merged = unicode(translate('OpenLP.core.lib', '%1, %2',
+ u'Locale list separator: middle').arg(stringlist[index], merged))
+ return unicode(translate('OpenLP.core.lib', '%1, %2',
+ u'Locale list separator: start').arg(stringlist[0], merged))
+
from eventreceiver import Receiver
from listwidgetwithdnd import ListWidgetWithDnD
from formattingtags import FormattingTags
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2012-01-18 17:52:48 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2012-02-16 20:41:21 +0000
@@ -31,7 +31,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
- translate
+ translate, create_separated_list
from openlp.core.lib.searchedit import SearchEdit
from openlp.core.lib.ui import UiStrings, add_widget_completer, \
media_item_combo_box, critical_error_message_box, \
@@ -868,7 +868,7 @@
service_item.add_capability(ItemCapabilities.CanLoop)
service_item.add_capability(ItemCapabilities.CanWordSplit)
# Service Item: Title
- service_item.title = u', '.join(raw_title)
+ service_item.title = create_separated_list(raw_title)
# Service Item: Theme
if len(self.settings.bible_theme) == 0:
service_item.theme = None
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2011-12-27 10:33:55 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2012-02-16 20:41:21 +0000
@@ -32,7 +32,8 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import PluginStatus, Receiver, MediaType, translate
+from openlp.core.lib import PluginStatus, Receiver, MediaType, translate, \
+ create_separated_list
from openlp.core.lib.ui import UiStrings, add_widget_completer, \
critical_error_message_box, find_and_set_in_combo_box
from openlp.core.utils import AppLocation
@@ -633,7 +634,7 @@
VerseType.translated_tag(verse[0]), verse[1:]))
for count, item in enumerate(order):
if item not in verses:
- valid = u', '.join(verse_names)
+ valid = create_separated_list(verse_names)
critical_error_message_box(
message=unicode(translate('SongsPlugin.EditSongForm',
'The verse order is invalid. There is no verse '
=== modified file 'openlp/plugins/songs/forms/songexportform.py'
--- openlp/plugins/songs/forms/songexportform.py 2012-01-18 13:50:06 +0000
+++ openlp/plugins/songs/forms/songexportform.py 2012-02-16 20:41:21 +0000
@@ -33,7 +33,8 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import build_icon, Receiver, SettingsManager, translate
+from openlp.core.lib import build_icon, Receiver, SettingsManager, translate, \
+ create_separated_list
from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
from openlp.plugins.songs.lib.db import Song
@@ -255,7 +256,7 @@
# No need to export temporary songs.
if song.temporary:
continue
- authors = u', '.join([author.display_name
+ authors = create_separated_list([author.display_name
for author in song.authors])
title = u'%s (%s)' % (unicode(song.title), authors)
item = QtGui.QListWidgetItem(title)
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2012-01-18 13:50:06 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2012-02-16 20:41:21 +0000
@@ -35,7 +35,7 @@
from sqlalchemy.sql import or_
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
- translate, check_item_selected, PluginStatus
+ translate, check_item_selected, PluginStatus, create_separated_list
from openlp.core.lib.ui import UiStrings, context_menu_action, \
context_menu_separator
from openlp.core.utils import AppLocation
@@ -247,7 +247,8 @@
continue
author_list = [author.display_name for author in song.authors]
song_title = unicode(song.title)
- song_detail = u'%s (%s)' % (song_title, u', '.join(author_list))
+ song_detail = u'%s (%s)' % (song_title,
+ create_separated_list(author_list))
song_name = QtGui.QListWidgetItem(song_detail)
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
self.listView.addItem(song_name)
@@ -469,7 +470,7 @@
service_item.title = song.title
author_list = [unicode(author.display_name) for author in song.authors]
service_item.raw_footer.append(song.title)
- service_item.raw_footer.append(u', '.join(author_list))
+ service_item.raw_footer.append(create_separated_list(author_list))
service_item.raw_footer.append(song.copyright)
if QtCore.QSettings().value(u'general/ccli number',
QtCore.QVariant(u'')).toString():
Follow ups