X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/9d88c94317aeac5dd26c1dbe8c2112dbe855d2b5..73c04bcfe1096173b00431f0cdc742894b15eef0:/icuSources/i18n/datefmt.cpp diff --git a/icuSources/i18n/datefmt.cpp b/icuSources/i18n/datefmt.cpp index b2b75816..b07622c3 100644 --- a/icuSources/i18n/datefmt.cpp +++ b/icuSources/i18n/datefmt.cpp @@ -1,6 +1,6 @@ /* ******************************************************************************* -* Copyright (C) 1997-2004, International Business Machines Corporation and * +* Copyright (C) 1997-2006, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* * @@ -13,7 +13,7 @@ * 03/31/97 aliu Modified extensively to work with 50 locales. * 04/01/97 aliu Added support for centuries. * 08/12/97 aliu Fixed operator== to use Calendar::equivalentTo. -* 07/20/98 stephen Changed ParsePosition initialization +* 07/20/98 stephen Changed ParsePosition initialization ******************************************************************************** */ @@ -25,6 +25,9 @@ #include "unicode/datefmt.h" #include "unicode/smpdtfmt.h" +#include "cstring.h" +#include "windtfmt.h" + #if defined( U_DEBUG_CALSVC ) || defined (U_DEBUG_CAL) #include #endif @@ -267,8 +270,25 @@ DateFormat::createInstance() DateFormat* U_EXPORT2 DateFormat::create(EStyle timeStyle, EStyle dateStyle, const Locale& locale) { - // Try to create a SimpleDateFormat of the desired style. UErrorCode status = U_ZERO_ERROR; +#ifdef U_WINDOWS + char buffer[8]; + int32_t count = locale.getKeywordValue("compat", buffer, sizeof(buffer), status); + + // if the locale has "@compat=host", create a host-specific DateFormat... + if (count > 0 && uprv_strcmp(buffer, "host") == 0) { + Win32DateFormat *f = new Win32DateFormat(timeStyle, dateStyle, locale, status); + + if (U_SUCCESS(status)) { + return f; + } + + delete f; + } +#endif + + + // Try to create a SimpleDateFormat of the desired style. SimpleDateFormat *f = new SimpleDateFormat(timeStyle, dateStyle, locale, status); if (U_SUCCESS(status)) return f; delete f;