]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/log.cpp
Update version to 2.9.4 in version.bkl too and rebake everything.
[wxWidgets.git] / src / common / log.cpp
index 88e715f80082510f1d4f24d6cb2d6c518d130bbf..20b146d2de65864a99ca05d6510a05cf465b34a6 100644 (file)
@@ -216,12 +216,24 @@ unsigned wxLog::LogLastRepeatIfNeeded()
     {
         wxString msg;
 #if wxUSE_INTL
     {
         wxString msg;
 #if wxUSE_INTL
-        msg.Printf(wxPLURAL("The previous message repeated once.",
-                            "The previous message repeated %lu times.",
-                            gs_prevLog.numRepeated),
-                   gs_prevLog.numRepeated);
+        if ( gs_prevLog.numRepeated == 1 )
+        {
+            // We use a separate message for this case as "repeated 1 time"
+            // looks somewhat strange.
+            msg = _("The previous message repeated once.");
+        }
+        else
+        {
+            // Notice that we still use wxPLURAL() to ensure that multiple
+            // numbers of times are correctly formatted, even though we never
+            // actually use the singular string.
+            msg.Printf(wxPLURAL("The previous message repeated %lu time.",
+                                "The previous message repeated %lu times.",
+                                gs_prevLog.numRepeated),
+                       gs_prevLog.numRepeated);
+        }
 #else
 #else
-        msg.Printf(wxS("The previous message was repeated %lu times."),
+        msg.Printf(wxS("The previous message was repeated %lu time(s)."),
                    gs_prevLog.numRepeated);
 #endif
         gs_prevLog.numRepeated = 0;
                    gs_prevLog.numRepeated);
 #endif
         gs_prevLog.numRepeated = 0;
@@ -240,7 +252,16 @@ wxLog::~wxLog()
     {
         wxMessageOutputDebug().Printf
         (
     {
         wxMessageOutputDebug().Printf
         (
-            wxS("Last repeated message (\"%s\", %lu times) wasn't output"),
+#if wxUSE_INTL
+            wxPLURAL
+            (
+                "Last repeated message (\"%s\", %lu time) wasn't output",
+                "Last repeated message (\"%s\", %lu times) wasn't output",
+                gs_prevLog.numRepeated
+            ),
+#else
+            wxS("Last repeated message (\"%s\", %lu time(s)) wasn't output"),
+#endif
             gs_prevLog.msg,
             gs_prevLog.numRepeated
         );
             gs_prevLog.msg,
             gs_prevLog.numRepeated
         );
@@ -676,16 +697,8 @@ void wxLog::TimeStamp(wxString *str)
 #if wxUSE_DATETIME
     if ( !ms_timestamp.empty() )
     {
 #if wxUSE_DATETIME
     if ( !ms_timestamp.empty() )
     {
-        wxChar buf[256];
-        time_t timeNow;
-        (void)time(&timeNow);
-
-        struct tm tm;
-        wxStrftime(buf, WXSIZEOF(buf),
-                    ms_timestamp, wxLocaltime_r(&timeNow, &tm));
-
-        str->Empty();
-        *str << buf << wxS(": ");
+        *str = wxDateTime::UNow().Format(ms_timestamp);
+        *str += wxS(": ");
     }
 #endif // wxUSE_DATETIME
 }
     }
 #endif // wxUSE_DATETIME
 }
@@ -852,7 +865,7 @@ wxLogChain::wxLogChain(wxLog *logger)
 
 wxLogChain::~wxLogChain()
 {
 
 wxLogChain::~wxLogChain()
 {
-    delete m_logOld;
+    wxLog::SetActiveTarget(m_logOld);
 
     if ( m_logNew != this )
         delete m_logNew;
 
     if ( m_logNew != this )
         delete m_logNew;