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:
parent
1e1278f46f
commit
ec17468f63
@ -37,6 +37,8 @@ public:
|
||||
|
||||
const char* GetLanginfo(int index);
|
||||
|
||||
const Locale& ICULocaleForStrings() const;
|
||||
|
||||
private:
|
||||
status_t _SetLCTimeEntries(const UnicodeString* strings,
|
||||
char* destination, int entrySize,
|
||||
|
@ -123,7 +123,7 @@ ICUTimeConversion::TZSet(const char* timeZoneID, const char* tz)
|
||||
} else {
|
||||
UnicodeString icuString;
|
||||
fTimeZone->getDisplayName(i == 1, TimeZone::SHORT,
|
||||
fTimeData.ICULocale(), icuString);
|
||||
fTimeData.ICULocaleForStrings(), icuString);
|
||||
CheckedArrayByteSink byteSink(fDataBridge->addrOfTZName[i],
|
||||
sizeof(fTimeZoneID));
|
||||
icuString.toUTF8(byteSink);
|
||||
|
@ -69,19 +69,7 @@ ICUTimeData::SetTo(const Locale& locale, const char* posixLocaleName)
|
||||
return result;
|
||||
|
||||
UErrorCode icuStatus = U_ZERO_ERROR;
|
||||
|
||||
// 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);
|
||||
DateFormatSymbols formatSymbols(ICULocaleForStrings(), icuStatus);
|
||||
if (!U_SUCCESS(icuStatus))
|
||||
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
|
||||
ICUTimeData::_SetLCTimeEntries(const UnicodeString* strings, char* destination,
|
||||
int entrySize, int count, int maxCount)
|
||||
|
Loading…
Reference in New Issue
Block a user