Display timestamps using the application locale
authorDaniel Albers <daniel@lbe.rs>
Mon, 10 Dec 2012 14:33:52 +0000 (15:33 +0100)
committerDaniel Albers <daniel@lbe.rs>
Mon, 10 Dec 2012 15:03:03 +0000 (16:03 +0100)
Reverts configuration of timestamp formats via translation files.
Formatting of timestamps and such should completely move from core to client at
some point.
Fixes #1199

src/core/eventstringifier.cpp
src/uisupport/uistyle.cpp

index ac0a3ac..e7ad58d 100644 (file)
@@ -457,14 +457,13 @@ void EventStringifier::processIrcEvent317(IrcEvent *e)
 
     if (e->params().count() > 3) { // if we have more then 3 params we have the above mentioned "real life" situation
         QDateTime loginTime = QDateTime::fromTime_t(e->params()[2].toInt());
 
     if (e->params().count() > 3) { // if we have more then 3 params we have the above mentioned "real life" situation
         QDateTime loginTime = QDateTime::fromTime_t(e->params()[2].toInt());
-        //: Time format. See http://qt-project.org/doc/qt-4.8/qdatetime.html#toString
-        QString formattedLoginTime = loginTime.toString(tr("MMMM d yyyy hh:mm"));
-        displayMsg(e, Message::Server, tr("[Whois] %1 is logged in since %2").arg(e->params()[0], formattedLoginTime));
+        displayMsg(e, Message::Server, tr("[Whois] %1 is logged in since %2")
+           .arg(e->params()[0], QLocale().toString(loginTime, QLocale().dateTimeFormat())));
     }
     }
-    //: Time format. See http://qt-project.org/doc/qt-4.8/qdatetime.html#toString
-    QString idlingSince = e->timestamp().toLocalTime().addSecs(-idleSecs).toString(tr("MMMM d yyyy hh:mm"));
+    QDateTime idlingSince = e->timestamp().toLocalTime().addSecs(-idleSecs);
     displayMsg(e, Message::Server, tr("[Whois] %1 is idling for %2 (since %3)")
     displayMsg(e, Message::Server, tr("[Whois] %1 is idling for %2 (since %3)")
-        .arg(e->params()[0], secondsToString(idleSecs), idlingSince));
+        .arg(e->params()[0], secondsToString(idleSecs),
+            QLocale().toString(idlingSince, QLocale().dateTimeFormat())));
 }
 
 
 }
 
 
@@ -563,9 +562,9 @@ void EventStringifier::processIrcEvent329(IrcEvent *e)
         return;
     }
     QDateTime time = QDateTime::fromTime_t(unixtime);
         return;
     }
     QDateTime time = QDateTime::fromTime_t(unixtime);
-    //: Time format. See http://qt-project.org/doc/qt-4.8/qdatetime.html#toString
-    QString formattedTime = time.toString(tr("MMMM d yyyy hh:mm"));
-    displayMsg(e, Message::Topic, tr("Channel %1 created on %2").arg(channel, formattedTime), QString(), channel);
+    displayMsg(e, Message::Topic, tr("Channel %1 created on %2")
+        .arg(channel, QLocale().toString(time, QLocale().dateTimeFormat())),
+       QString(), channel);
 }
 
 
 }
 
 
@@ -608,10 +607,10 @@ void EventStringifier::processIrcEvent333(IrcEvent *e)
         return;
 
     QString channel = e->params().first();
         return;
 
     QString channel = e->params().first();
-    //: Time format. See http://qt-project.org/doc/qt-4.8/qdatetime.html#toString
-    QString topicSetTime = QDateTime::fromTime_t(e->params()[2].toInt()).toString(tr("MMMM d yyyy hh:mm"));
+    QDateTime topicSetTime = QDateTime::fromTime_t(e->params()[2].toInt());
     displayMsg(e, Message::Topic, tr("Topic set by %1 on %2")
     displayMsg(e, Message::Topic, tr("Topic set by %1 on %2")
-        .arg(e->params()[1], topicSetTime), QString(), channel);
+        .arg(e->params()[1],
+            QLocale().toString(topicSetTime, QLocale().dateTimeFormat()), QString(), channel));
 }
 
 
 }
 
 
index 549f5a9..1e78e38 100644 (file)
@@ -688,10 +688,8 @@ void UiStyle::StyledMessage::style() const
         t = tr("%1").arg(txt); break;
     case Message::DayChange:
     {
         t = tr("%1").arg(txt); break;
     case Message::DayChange:
     {
-        //: Date format. See http://qt-project.org/doc/qt-4.8/qdate.html#toString
-        QString newDate = timestamp().toString(tr("MMMM d yyyy"));
         //: Day Change Message
         //: Day Change Message
-        t = tr("{Day changed to %1}").arg(newDate);
+        t = tr("{Day changed to %1}").arg(QLocale().toString(timestamp(), QLocale().dateFormat()));
     }
         break;
     case Message::Topic:
     }
         break;
     case Message::Topic: