Use ungettext instead of ngettext for unicode support.

This commit is contained in:
Philipp Wolfer
2010-01-19 18:51:48 +01:00
parent 21c8215b5b
commit f628ec2456
2 changed files with 7 additions and 7 deletions

View File

@@ -231,13 +231,13 @@ class Tagger(QtGui.QApplication):
self.log.debug("Loading gettext translation, localedir=%r", localedir)
self.translation = gettext.translation("picard", localedir)
self.translation.install(True)
ngettext = self.translation.ngettext
ungettext = self.translation.ungettext
except IOError:
__builtin__.__dict__['_'] = lambda a: a
def ngettext(a, b, c):
def ungettext(a, b, c):
if c == 1: return a
else: return b
__builtin__.__dict__['ngettext'] = ngettext
__builtin__.__dict__['ungettext'] = ungettext
def move_files_to_album(self, files, albumid=None, album=None):
"""Move `files` to tracks on album `albumid`."""

View File

@@ -68,7 +68,7 @@ class TagEditor(QtGui.QDialog):
if total == 1:
title += files[0].base_filename
else:
title += ngettext("%d file", "%d files", total) % total
title += ungettext("%d file", "%d files", total) % total
self.setWindowTitle(title)
self.ui.buttonbox.addButton(StandardButton(StandardButton.OK), QtGui.QDialogButtonBox.AcceptRole)
@@ -128,10 +128,10 @@ class TagEditor(QtGui.QDialog):
item.setFont(1, font)
missing = total - counts[name]
if not missing:
value = ngettext("(different across %d file)",
value = ungettext("(different across %d file)",
"(different across %d files)", total) % total
else:
value = ngettext("(missing from %d file)",
value = ungettext("(missing from %d file)",
"(missing from %d files)", missing) % missing
item.setText(1, value)
@@ -262,4 +262,4 @@ class TagEditor(QtGui.QDialog):
text = '<br/>'.join(map(lambda i: '<b>%s</b><br/>%s' % i, info))
self.ui.info.setText(text)
else:
self.ui.info.setText(ngettext("%d file", "%d files", total) % total)
self.ui.info.setText(ungettext("%d file", "%d files", total) % total)