[rkward-cvs] SF.net SVN: rkward-code:[4980] trunk/rkward/rkward

tfry at users.sf.net tfry at users.sf.net
Thu Oct 30 13:17:17 UTC 2014


Revision: 4980
          http://sourceforge.net/p/rkward/code/4980
Author:   tfry
Date:     2014-10-30 13:17:17 +0000 (Thu, 30 Oct 2014)
Log Message:
-----------
Fix replacement bug in i18np/i18ncp

Modified Paths:
--------------
    trunk/rkward/rkward/dialogs/rkrecoverdialog.cpp
    trunk/rkward/rkward/misc/rkmessagecatalog.cpp

Modified: trunk/rkward/rkward/dialogs/rkrecoverdialog.cpp
===================================================================
--- trunk/rkward/rkward/dialogs/rkrecoverdialog.cpp	2014-10-30 09:29:30 UTC (rev 4979)
+++ trunk/rkward/rkward/dialogs/rkrecoverdialog.cpp	2014-10-30 13:17:17 UTC (rev 4980)
@@ -51,8 +51,8 @@
 	QLabel *label = new QLabel (this);
 	QString text = QString ("<p><b>%1</b></p>").arg (caption);
 	text.append (i18n ("<p>It looks like RKWard has crashed, recently. We are sorry about that! However, not everything is lost, and with a bit of luck, your data has been saved in time.</p>"));
-	text.append (i18np ("<p>A workspace recovery file exists, dating from <i>%2</i></p>", "<p>%1 workspace recovery files exist, the most recent one of which dates from <i>%2</i>.</p>", recovery_files.count (), QFileInfo (recovery_files.first ()).lastModified ().toString (Qt::SystemLocaleLongDate)));
-	text.append (i18n ("<p>Do you want to open this file, now, save it for later (as %1), or discard it?</p>", saveFileFor (recovery_files.first ())));
+	text.append (i18np ("<p>A workspace recovery file exists, dating from <i>%2</i>.</p>", "<p>%1 workspace recovery files exist, the most recent one of which dates from <i>%2</i>.</p>", recovery_files.count (), QFileInfo (recovery_files.first ()).lastModified ().toString (Qt::SystemLocaleShortDate)));
+	text.append (i18n ("<p>Do you want to open this file, now, save it for later (as <i>%1</i>), or discard it?</p>", saveFileFor (recovery_files.first ())));
 	label->setText (text);
 	label->setWordWrap (true);
 	setMainWidget (label);

Modified: trunk/rkward/rkward/misc/rkmessagecatalog.cpp
===================================================================
--- trunk/rkward/rkward/misc/rkmessagecatalog.cpp	2014-10-30 09:29:30 UTC (rev 4979)
+++ trunk/rkward/rkward/misc/rkmessagecatalog.cpp	2014-10-30 13:17:17 UTC (rev 4980)
@@ -63,7 +63,8 @@
 		if (count == 1) return msgid_singular.arg (count);
 		return msgid_plural.arg (count);
 	}
-	return QString::fromUtf8 (trans).arg (count);
+	return QString::fromUtf8 (trans).replace (QLatin1String ("%1"), QString::number (count));	// NOTE: Not using .arg(count), as "%1" may not be given in both singular and plural form.
+																								// .arg() would go replacing "%2", then.
 }
 
 QString RKMessageCatalog::translate (const QString &msgid) const {
@@ -75,7 +76,7 @@
 QString RKMessageCatalog::translate (const QString &msgid_singular, const QString &msgid_plural, unsigned long int count) const {
 	RK_TRACE (MISC);
 
-	return QString::fromUtf8 (dngettext (catalog_name, msgid_singular.toUtf8 (), msgid_plural.toUtf8 (), count)).arg (count);
+	return QString::fromUtf8 (dngettext (catalog_name, msgid_singular.toUtf8 (), msgid_plural.toUtf8 (), count)).replace (QLatin1String ("%1"), QString::number (count));
 }
 
 // static





More information about the rkward-tracker mailing list