- switch ( actualType )
- {
- case wxDAY:
- if ( (day_of_week < 1) || (day_of_week > 7) )
- strcpy(buf,"invalid day");
- else
- strncpy( buf, dayname[day_of_week-1],
- (DisplayOptions & wxDATE_ABBR) ? ABBR_LENGTH : 9);
- return wxString(buf);
-
- case wxMONTH:
- if ( (month < 1) || (month > 12) )
- strcpy(buf,"invalid month");
- else
- strncpy( buf, mname[month-1],
- (DisplayOptions & wxDATE_ABBR) ? ABBR_LENGTH : 9);
- return wxString(buf);
-
- case wxFULL:
- if ( (month < 1) || (month > 12) || (day_of_week < 0) ||
- (day_of_week > 7) )
- {
- strcpy(buf,"invalid date");
- return wxString(buf);
- }
- strncpy( buf, dayname[day_of_week-1],
- (DisplayOptions & wxDATE_ABBR) ? ABBR_LENGTH : 9);
- strcat( buf, ", ");
- strncat( buf, mname[month-1],
- (DisplayOptions & wxDATE_ABBR) ? ABBR_LENGTH : 9);
- strcat( buf, " ");
- sprintf( buf+strlen(buf), "%d, %d", day, abs(year) );
- if (year < 0)
- strcat(buf," B.C.");
- return wxString(buf);
-
- case wxEUROPEAN:
- if ( (month < 1) || (month > 12) || (day_of_week < 0) ||
- (day_of_week > 7) )
- {
- strcpy(buf,"invalid date");
- return wxString(buf);
- }
- sprintf(buf,"%d ", day);
- strncat(buf, mname[month-1],
- (DisplayOptions & wxDATE_ABBR) ? ABBR_LENGTH : 9);
- sprintf( buf+strlen(buf), " %d", abs(year) );
- if (year < 0)
- strcat(buf," B.C.");
- return wxString(buf);
-
- case wxMDY:
- default:
- if (day==0 || month==0 || year==0)
- strcpy(buf,"invalid date");
- else
- sprintf( buf+strlen(buf), "%1d/%1d/%02d", month, day,
- (DisplayOptions & wxNO_CENTURY) && (abs(year) > 1899)
- ? (abs(year) - (abs(year) / 100 * 100))
- : (abs(year)) );
- return wxString(buf);
- }
- return wxString("");
-}
-
-void wxDate::SetFormat( const int format )
-{
- DisplayFormat = format;
-}
-
-int wxDate::SetOption( const int option, const bool action )
-{
- switch ( option )
- {
- case wxNO_CENTURY:
- if ( action )
- DisplayOptions |= wxNO_CENTURY;
- else
- {
- DisplayOptions &= (~wxNO_CENTURY);
- }
- return 1;
- case wxDATE_ABBR:
- if ( action )
- DisplayOptions |= wxDATE_ABBR;
- else
- {
- DisplayOptions &= (~wxDATE_ABBR);
- }
- return 1;
- default:
- return 0;
- }
- return 0;
+ switch ( actualType )
+ {
+ case wxDAY:
+ if ( (day_of_week < 1) || (day_of_week > 7) )
+ wxStrcpy(buf, _("invalid day"));
+ else
+ wxStrncpy( buf, wxGetTranslation(dayname[day_of_week-1]),
+ (DisplayOptions & wxDATE_ABBR) ? ABBR_LENGTH : 9);
+ return wxString(buf);
+
+ case wxMONTH:
+ if ( (month < 1) || (month > 12) )
+ wxStrcpy(buf, _("invalid month"));
+ else
+ wxStrncpy( buf, wxGetTranslation(mname[month-1]),
+ (DisplayOptions & wxDATE_ABBR) ? ABBR_LENGTH : 9);
+ return wxString(buf);
+
+ case wxFULL:
+ if ( (month < 1) || (month > 12) || (day_of_week < 0) ||
+ (day_of_week > 7) )
+ {
+ wxStrcpy(buf, _("invalid date"));
+ return wxString(buf);
+ }
+ wxStrncpy( buf, wxGetTranslation(dayname[day_of_week-1]),
+ (DisplayOptions & wxDATE_ABBR) ? ABBR_LENGTH : 9);
+ wxStrcat( buf, _T(", "));
+ wxStrncat( buf, wxGetTranslation(mname[month-1]),
+ (DisplayOptions & wxDATE_ABBR) ? ABBR_LENGTH : 9);
+ wxStrcat( buf, _T(" "));
+ wxSprintf( buf+wxStrlen(buf), _T("%d, %d"), day, abs(year) );
+ if (year < 0)
+ wxStrcat(buf,_(" B.C."));
+ return wxString(buf);
+
+ case wxEUROPEAN:
+ if ( (month < 1) || (month > 12) || (day_of_week < 0) ||
+ (day_of_week > 7) )
+ {
+ wxStrcpy(buf, _("invalid date"));
+ return wxString(buf);
+ }
+ wxSprintf(buf,_T("%d "), day);
+ wxStrncat(buf, wxGetTranslation(mname[month-1]),
+ (DisplayOptions & wxDATE_ABBR) ? ABBR_LENGTH : 9);
+ wxSprintf( buf+wxStrlen(buf), _T(" %d"), abs(year) );
+ if (year < 0)
+ wxStrcat(buf, _(" B.C."));
+ return wxString(buf);
+
+ case wxMDY:
+ default:
+ if (day==0 || month==0 || year==0)
+ wxStrcpy(buf, _("invalid date"));
+ else
+ wxSprintf( buf+wxStrlen(buf), _T("%1d/%1d/%02d"), month, day,
+ (DisplayOptions & wxNO_CENTURY) && (abs(year) > 1899)
+ ? (abs(year) - (abs(year) / 100 * 100))
+ : (abs(year)) );
+ return wxString(buf);
+ }
+ return wxString(_T(""));
+}
+
+void wxDate::SetFormat( int format )
+{
+ DisplayFormat = format;
+}
+
+int wxDate::SetOption( int option, bool action )
+{
+ switch ( option )
+ {
+ case wxNO_CENTURY:
+ if ( action )
+ DisplayOptions |= wxNO_CENTURY;
+ else
+ {
+ DisplayOptions &= (~wxNO_CENTURY);
+ }
+ return 1;
+ case wxDATE_ABBR:
+ if ( action )
+ DisplayOptions |= wxDATE_ABBR;
+ else
+ {
+ DisplayOptions &= (~wxDATE_ABBR);
+ }
+ return 1;
+ default:
+ return 0;
+ }
+ return 0;