// Specification of the input: // http://icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details static String localizeFormat(const Vector<UChar>& buffer) { StringBuilder builder; UChar lastChar = 0; bool inQuote = false; for (unsigned i = 0; i < buffer.size(); ++i) { if (inQuote) { if (buffer[i] == '\'') { inQuote = false; lastChar = 0; ASSERT(i); if (buffer[i - 1] == '\'') builder.append('\''); } else builder.append(buffer[i]); } else { if (isASCIIAlpha(lastChar) && lastChar == buffer[i]) continue; lastChar = buffer[i]; if (isICUYearSymbol(lastChar)) { String text = dateFormatYearText(); builder.append(text.isEmpty() ? "Year" : text); } else if (isICUMonthSymbol(lastChar)) { String text = dateFormatMonthText(); builder.append(text.isEmpty() ? "Month" : text); } else if (isICUDayInMonthSymbol(lastChar)) { String text = dateFormatDayInMonthText(); builder.append(text.isEmpty() ? "Day" : text); } else if (lastChar == '\'') inQuote = true; else builder.append(lastChar); } } return builder.toString(); }
String LocaleWin::dateFormatText() { ensureShortDateTokens(); return substituteLabelsIntoFormat(m_shortDateTokens, dateFormatYearText(), dateFormatMonthText(), dateFormatDayInMonthText()); }