X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a16e51b56ac3c46af2f2f7630c8e71b30c2b374d..08670ea85abf4b4946a9ce64971b591d7b1ee30b:/src/common/log.cpp diff --git a/src/common/log.cpp b/src/common/log.cpp index dd0f26e1d6..20b146d2de 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -216,12 +216,24 @@ unsigned wxLog::LogLastRepeatIfNeeded() { 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 - 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; @@ -240,7 +252,16 @@ wxLog::~wxLog() { 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 ); @@ -676,16 +697,8 @@ void wxLog::TimeStamp(wxString *str) #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 }