+// helper function translating week day/month names from English to the current
+// locale
+static wxString TranslateDate(const wxString& str)
+{
+ // small optimization: if there are no alphabetic characters in the string,
+ // there is nothing to translate
+ wxString::const_iterator i, end = str.end();
+ for ( i = str.begin(); i != end; ++i )
+ {
+ if ( isalpha(*i) )
+ break;
+ }
+
+ if ( i == end )
+ return str;
+
+ wxString trans(str);
+
+ static const char *weekdays[] =
+ {
+ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
+ };
+
+ for ( wxDateTime::WeekDay wd = wxDateTime::Sun;
+ wd < wxDateTime::Inv_WeekDay;
+ wxNextWDay(wd) )
+ {
+ trans.Replace
+ (
+ weekdays[wd],
+ wxDateTime::GetWeekDayName(wd, wxDateTime::Name_Abbr)
+ );
+ }
+
+
+ static const char *months[] =
+ {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
+ "Nov", "Dec"
+ };
+
+ for ( wxDateTime::Month mon = wxDateTime::Jan;
+ mon < wxDateTime::Inv_Month;
+ wxNextMonth(mon) )
+ {
+ trans.Replace
+ (
+ months[mon],
+ wxDateTime::GetMonthName(mon, wxDateTime::Name_Abbr)
+ );
+ }
+
+ return trans;
+}
+