diff --git a/icu4c/source/i18n/smpdtfmt.cpp b/icu4c/source/i18n/smpdtfmt.cpp index ad55de49a90..025f0ccae18 100644 --- a/icu4c/source/i18n/smpdtfmt.cpp +++ b/icu4c/source/i18n/smpdtfmt.cpp @@ -1513,7 +1513,7 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo, zeroPaddingNumber(currentNumberFormat,appendTo, value, count, maxIntCount); break; } - +#if !UCONFIG_NO_BREAK_ITERATION if (fieldNum == 0) { // first field, check to see whether we need to titlecase it UBool titlecase = FALSE; @@ -1536,6 +1536,7 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo, firstField.toTitle(NULL, fLocale, U_TITLECASE_NO_LOWERCASE | U_TITLECASE_NO_BREAK_ADJUSTMENT); appendTo.replaceBetween(beginOffset, appendTo.length(), firstField); } +#endif } handler.addAttribute(fgPatternIndexToDateFormatField[patternCharIndex], beginOffset, appendTo.length()); diff --git a/icu4c/source/i18n/unicode/udat.h b/icu4c/source/i18n/unicode/udat.h index 4fa7cca9c7b..3b64b99635e 100644 --- a/icu4c/source/i18n/unicode/udat.h +++ b/icu4c/source/i18n/unicode/udat.h @@ -178,12 +178,14 @@ typedef enum UDateFormatStyle { * @draft ICU 49 */ typedef enum UDateFormatContextType { +#if !UCONFIG_NO_BREAK_ITERATION /** * Type (key) for specifying the capitalization context for which a date * is to be formatted (possible values are in UDateFormatContextValue). * @draft ICU 49 */ UDAT_CAPITALIZATION = 1 +#endif } UDateFormatContextType; /** Values for date format context types @@ -199,6 +201,7 @@ typedef enum UDateFormatContextValue { * @draft ICU 49 */ UDAT_CONTEXT_UNKNOWN = 0, +#if !UCONFIG_NO_BREAK_ITERATION /** Values for type (key) UDAT_CAPITALIZATION */ /** * UDAT_CAPITALIZATION value if a date (or date symbol) is to be formatted @@ -225,6 +228,7 @@ typedef enum UDateFormatContextValue { * @draft ICU 49 */ UDAT_CAPITALIZATION_FOR_STANDALONE = 4 +#endif } UDateFormatContextValue; /** diff --git a/icu4c/source/test/cintltst/cdattst.c b/icu4c/source/test/cintltst/cdattst.c index 9fe124891a8..34b396af61d 100644 --- a/icu4c/source/test/cintltst/cdattst.c +++ b/icu4c/source/test/cintltst/cdattst.c @@ -1251,15 +1251,19 @@ typedef struct { static const TestContextItem textContextItems[] = { { "fr", skeleton_yMMMM, UDAT_CONTEXT_UNKNOWN, july2008_frDefault }, +#if !UCONFIG_NO_BREAK_ITERATION { "fr", skeleton_yMMMM, UDAT_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE, july2008_frDefault }, { "fr", skeleton_yMMMM, UDAT_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE, july2008_frTitle }, { "fr", skeleton_yMMMM, UDAT_CAPITALIZATION_FOR_UI_LIST_OR_MENU, july2008_frDefault }, { "fr", skeleton_yMMMM, UDAT_CAPITALIZATION_FOR_STANDALONE, july2008_frTitle }, +#endif { "cs", skeleton_yMMMM, UDAT_CONTEXT_UNKNOWN, july2008_csDefault }, +#if !UCONFIG_NO_BREAK_ITERATION { "cs", skeleton_yMMMM, UDAT_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE, july2008_csDefault }, { "cs", skeleton_yMMMM, UDAT_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE, july2008_csTitle }, { "cs", skeleton_yMMMM, UDAT_CAPITALIZATION_FOR_UI_LIST_OR_MENU, july2008_csTitle }, { "cs", skeleton_yMMMM, UDAT_CAPITALIZATION_FOR_STANDALONE, july2008_csDefault }, +#endif { NULL, NULL, 0, NULL } }; @@ -1283,6 +1287,7 @@ static void TestContext(void) { if ( U_FAILURE(status) ) { log_err("FAIL: udatpg_getBestPattern for locale %s, status %s\n", textContextItemPtr->locale, u_errorName(status) ); } else { +#if !UCONFIG_NO_BREAK_ITERATION udat_applyPattern(udfmt, FALSE, ubuf, len); udat_setDefaultContext(udfmt, UDAT_CAPITALIZATION, textContextItemPtr->capitalizationContext, &status); if ( U_FAILURE(status) ) { @@ -1311,6 +1316,7 @@ static void TestContext(void) { textContextItemPtr->locale, (int)textContextItemPtr->capitalizationContext, getContext ); } } +#endif } udatpg_close(udtpg); } diff --git a/icu4c/source/test/cintltst/udatatst.c b/icu4c/source/test/cintltst/udatatst.c index d2188113b5a..dd6e75f7ec9 100644 --- a/icu4c/source/test/cintltst/udatatst.c +++ b/icu4c/source/test/cintltst/udatatst.c @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1998-2011, International Business Machines Corporation and + * Copyright (c) 1998-2012, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /* @@ -1335,7 +1335,7 @@ static const struct { {"ucase", "icu", ucase_swap}, {"ubidi", "icu", ubidi_swap}, #endif -#if !UCONFIG_NO_NORMALIZATION +#if !UCONFIG_NO_NORMALIZATION && !UCONFIG_ONLY_COLLATION {"nfc", "nrm", unorm2_swap}, {"confusables", "cfu", uspoof_swap}, #endif diff --git a/icu4c/source/test/intltest/dtfmttst.cpp b/icu4c/source/test/intltest/dtfmttst.cpp index 68552d93044..359fb0ecfb0 100644 --- a/icu4c/source/test/intltest/dtfmttst.cpp +++ b/icu4c/source/test/intltest/dtfmttst.cpp @@ -3845,15 +3845,19 @@ void DateFormatTest::TestContext() const TestContextItem items[] = { //locale pattern capitalizationContext expected formatted date { "fr", UnicodeString("MMMM y"), UDAT_CONTEXT_UNKNOWN, UnicodeString("juillet 2008") }, +#if !UCONFIG_NO_BREAK_ITERATION { "fr", UnicodeString("MMMM y"), UDAT_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE, UnicodeString("juillet 2008") }, { "fr", UnicodeString("MMMM y"), UDAT_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE, UnicodeString("Juillet 2008") }, { "fr", UnicodeString("MMMM y"), UDAT_CAPITALIZATION_FOR_UI_LIST_OR_MENU, UnicodeString("juillet 2008") }, { "fr", UnicodeString("MMMM y"), UDAT_CAPITALIZATION_FOR_STANDALONE, UnicodeString("Juillet 2008") }, +#endif { "cs", UnicodeString("LLLL y"), UDAT_CONTEXT_UNKNOWN, CharsToUnicodeString("\\u010Dervenec 2008") }, +#if !UCONFIG_NO_BREAK_ITERATION { "cs", UnicodeString("LLLL y"), UDAT_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE, CharsToUnicodeString("\\u010Dervenec 2008") }, { "cs", UnicodeString("LLLL y"), UDAT_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE, CharsToUnicodeString("\\u010Cervenec 2008") }, { "cs", UnicodeString("LLLL y"), UDAT_CAPITALIZATION_FOR_UI_LIST_OR_MENU, CharsToUnicodeString("\\u010Cervenec 2008") }, { "cs", UnicodeString("LLLL y"), UDAT_CAPITALIZATION_FOR_STANDALONE, CharsToUnicodeString("\\u010Dervenec 2008") }, +#endif // terminator { NULL, UnicodeString(""), (UDateFormatContextValue)0, UnicodeString("") } }; @@ -3871,6 +3875,7 @@ void DateFormatTest::TestContext() if (U_FAILURE(status)) { dataerrln(UnicodeString("FAIL: Unable to create SimpleDateFormat for specified pattern with locale ") + UnicodeString(itemPtr->locale)); } else { +#if !UCONFIG_NO_BREAK_ITERATION UDateFormatContextType contextType = UDAT_CAPITALIZATION; UDateFormatContextValue contextValue = itemPtr->capitalizationContext; UnicodeString result; @@ -3881,6 +3886,7 @@ void DateFormatTest::TestContext() ", capitalizationContext " + (int)itemPtr->capitalizationContext + ", expected " + itemPtr->expectedFormat + ", got " + result); } +#endif } if (sdmft) { delete sdmft;