Allow switching of timezone string to messages locale, too.
* adjust POSIX locale backend to redirect the timezone string through the messages/time-locale indirection
This commit is contained in:
@@ -37,6 +37,8 @@ public:
|
|||||||
|
|
||||||
const char* GetLanginfo(int index);
|
const char* GetLanginfo(int index);
|
||||||
|
|
||||||
|
const Locale& ICULocaleForStrings() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
status_t _SetLCTimeEntries(const UnicodeString* strings,
|
status_t _SetLCTimeEntries(const UnicodeString* strings,
|
||||||
char* destination, int entrySize,
|
char* destination, int entrySize,
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ ICUTimeConversion::TZSet(const char* timeZoneID, const char* tz)
|
|||||||
} else {
|
} else {
|
||||||
UnicodeString icuString;
|
UnicodeString icuString;
|
||||||
fTimeZone->getDisplayName(i == 1, TimeZone::SHORT,
|
fTimeZone->getDisplayName(i == 1, TimeZone::SHORT,
|
||||||
fTimeData.ICULocale(), icuString);
|
fTimeData.ICULocaleForStrings(), icuString);
|
||||||
CheckedArrayByteSink byteSink(fDataBridge->addrOfTZName[i],
|
CheckedArrayByteSink byteSink(fDataBridge->addrOfTZName[i],
|
||||||
sizeof(fTimeZoneID));
|
sizeof(fTimeZoneID));
|
||||||
icuString.toUTF8(byteSink);
|
icuString.toUTF8(byteSink);
|
||||||
|
|||||||
@@ -69,19 +69,7 @@ ICUTimeData::SetTo(const Locale& locale, const char* posixLocaleName)
|
|||||||
return result;
|
return result;
|
||||||
|
|
||||||
UErrorCode icuStatus = U_ZERO_ERROR;
|
UErrorCode icuStatus = U_ZERO_ERROR;
|
||||||
|
DateFormatSymbols formatSymbols(ICULocaleForStrings(), icuStatus);
|
||||||
// check if the date strings should be taken from the messages-locale
|
|
||||||
// or from the time-locale (default)
|
|
||||||
const Locale* symbolsLocale = &fLocale;
|
|
||||||
char stringsValue[16];
|
|
||||||
fLocale.getKeywordValue("strings", stringsValue, sizeof(stringsValue),
|
|
||||||
icuStatus);
|
|
||||||
if (U_SUCCESS(icuStatus) && strcasecmp(stringsValue, "messages") == 0)
|
|
||||||
symbolsLocale = &fMessagesData.ICULocale();
|
|
||||||
else
|
|
||||||
icuStatus = U_ZERO_ERROR;
|
|
||||||
|
|
||||||
DateFormatSymbols formatSymbols(*symbolsLocale, icuStatus);
|
|
||||||
if (!U_SUCCESS(icuStatus))
|
if (!U_SUCCESS(icuStatus))
|
||||||
return B_UNSUPPORTED;
|
return B_UNSUPPORTED;
|
||||||
|
|
||||||
@@ -270,6 +258,22 @@ ICUTimeData::GetLanginfo(int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Locale&
|
||||||
|
ICUTimeData::ICULocaleForStrings() const
|
||||||
|
{
|
||||||
|
// check if the date strings should be taken from the messages-locale
|
||||||
|
// or from the time-locale (default)
|
||||||
|
UErrorCode icuStatus = U_ZERO_ERROR;
|
||||||
|
char stringsValue[16];
|
||||||
|
fLocale.getKeywordValue("strings", stringsValue, sizeof(stringsValue),
|
||||||
|
icuStatus);
|
||||||
|
if (U_SUCCESS(icuStatus) && strcasecmp(stringsValue, "messages") == 0)
|
||||||
|
return fMessagesData.ICULocale();
|
||||||
|
else
|
||||||
|
return fLocale;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
ICUTimeData::_SetLCTimeEntries(const UnicodeString* strings, char* destination,
|
ICUTimeData::_SetLCTimeEntries(const UnicodeString* strings, char* destination,
|
||||||
int entrySize, int count, int maxCount)
|
int entrySize, int count, int maxCount)
|
||||||
|
|||||||
Reference in New Issue
Block a user