s = QCoreApplication::translate("DataUtils", "%n day(s) ago", Q_NULLPTR, n);
} else if (seconds < (f = 60 * 60 * 24 * 30)) {
int n = seconds / (60 * 60 * 24 * 7);
- s = QCoreApplication::translate("DataUtils", "%n weeks(s) ago", Q_NULLPTR, n);
+ s = QCoreApplication::translate("DataUtils", "%n week(s) ago", Q_NULLPTR, n);
} else if (seconds < (f = 60 * 60 * 24 * 365)) {
int n = seconds / (60 * 60 * 24 * 30);
s = QCoreApplication::translate("DataUtils", "%n month(s) ago", Q_NULLPTR, n);
if (hours == 0) return res.sprintf("%d:%02d", minutes, seconds);
return res.sprintf("%d:%02d:%02d", hours, minutes, seconds);
}
+
+QString DataUtils::formatCount(int c) {
+ QString s;
+ int f = 1;
+ if (c < 1) {
+ return s;
+ } else if (c < (f *= 1000)) {
+ s = QString::number(c);
+ } else if (c < (f *= 1000)) {
+ int n = c / 1000;
+ s = QString::number(n) +
+ QCoreApplication::translate("DataUtils", "K", "K as in Kilo, i.e. thousands");
+ } else if (c < (f *= 1000)) {
+ int n = c / (1000 * 1000);
+ s = QString::number(n) +
+ QCoreApplication::translate("DataUtils", "M", "M stands for Millions");
+ } else {
+ int n = c / (1000 * 1000 * 1000);
+ s = QString::number(n) +
+ QCoreApplication::translate("DataUtils", "B", "B stands for Billions");
+ }
+
+ return QCoreApplication::translate("DataUtils", "%1 views").arg(s);
+}