mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-21 12:40:02 +00:00
ICU-4084 Improve the Calendar instantiation.
Converters/service registration aren't needed by default anymore. X-SVN-Rev: 16526
This commit is contained in:
parent
07b125019f
commit
01783a7d6a
1 changed files with 14 additions and 4 deletions
|
@ -342,6 +342,14 @@ public:
|
|||
|
||||
// -------------------------------------
|
||||
|
||||
static inline UBool
|
||||
isCalendarServiceUsed() {
|
||||
Mutex mutex;
|
||||
return (UBool)(gService != NULL);
|
||||
}
|
||||
|
||||
// -------------------------------------
|
||||
|
||||
static ICULocaleService*
|
||||
getCalendarService(UErrorCode &status)
|
||||
{
|
||||
|
@ -620,7 +628,12 @@ Calendar::createInstance(TimeZone* zone, const Locale& aLocale, UErrorCode& succ
|
|||
{
|
||||
Locale actualLoc;
|
||||
UObject* u;
|
||||
#if UCONFIG_NO_SERVICE
|
||||
#if !UCONFIG_NO_SERVICE
|
||||
if (isCalendarServiceUsed()) {
|
||||
u = getCalendarService(success)->get(aLocale, LocaleKey::KIND_ANY, &actualLoc, success);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
char calLocaleType[ULOC_FULLNAME_CAPACITY] = {"@calendar="};
|
||||
int32_t calLocaleTypeLen = uprv_strlen(calLocaleType);
|
||||
|
@ -648,9 +661,6 @@ Calendar::createInstance(TimeZone* zone, const Locale& aLocale, UErrorCode& succ
|
|||
#endif
|
||||
u = createStandardCalendar(calLocaleType, aLocale, success);
|
||||
}
|
||||
#else
|
||||
u = getCalendarService(success)->get(aLocale, LocaleKey::KIND_ANY, &actualLoc, success);
|
||||
#endif
|
||||
Calendar* c = NULL;
|
||||
|
||||
if(U_FAILURE(success) || !u) {
|
||||
|
|
Loading…
Add table
Reference in a new issue