| 63 | } |
| 64 | |
| 65 | UString GameTime::getLongDateString() const |
| 66 | { |
| 67 | std::stringstream ss; |
| 68 | if (DATE_LONG_FORMAT == nullptr) |
| 69 | { |
| 70 | apoc_date_facet *dateFacet = new apoc_date_facet("%A, %E %B, %Y"); |
| 71 | DATE_LONG_FORMAT = new std::locale(std::locale::classic(), dateFacet); |
| 72 | |
| 73 | std::vector<std::string> months = {tr("January"), tr("February"), tr("March"), |
| 74 | tr("April"), tr("May"), tr("June"), |
| 75 | tr("July"), tr("August"), tr("September"), |
| 76 | tr("October"), tr("November"), tr("December")}; |
| 77 | dateFacet->long_month_names(months); |
| 78 | |
| 79 | std::vector<std::string> weekdays = {tr("Sunday"), tr("Monday"), tr("Tuesday"), |
| 80 | tr("Wednesday"), tr("Thursday"), tr("Friday"), |
| 81 | tr("Saturday")}; |
| 82 | dateFacet->long_weekday_names(weekdays); |
| 83 | |
| 84 | std::vector<std::string> days = { |
| 85 | tr("1st"), tr("2nd"), tr("3rd"), tr("4th"), tr("5th"), tr("6th"), tr("7th"), |
| 86 | tr("8th"), tr("9th"), tr("10th"), tr("11th"), tr("12th"), tr("13th"), tr("14th"), |
| 87 | tr("15th"), tr("16th"), tr("17th"), tr("18th"), tr("19th"), tr("20th"), tr("21st"), |
| 88 | tr("22nd"), tr("23rd"), tr("24th"), tr("25th"), tr("26th"), tr("27th"), tr("28th"), |
| 89 | tr("29th"), tr("30th"), tr("31st")}; |
| 90 | dateFacet->longDayNames(days); |
| 91 | } |
| 92 | ss.imbue(*DATE_LONG_FORMAT); |
| 93 | ss << getPtime(this->ticks).date(); |
| 94 | return ss.str(); |
| 95 | } |
| 96 | |
| 97 | UString GameTime::getShortDateString() const |
| 98 | { |
no test coverage detected