mirror of
https://gitee.com/openharmony/global_i18n
synced 2024-11-23 15:10:32 +00:00
commit
af27c8d729
@ -60,7 +60,6 @@ private:
|
||||
std::string numeric = "always";
|
||||
std::string numberingSystem;
|
||||
LocaleInfo *localeInfo = nullptr;
|
||||
icu::NumberFormat *numberFormat = nullptr;
|
||||
icu::RelativeDateTimeFormatter *relativeTimeFormat = nullptr;
|
||||
UDateRelativeDateTimeFormatterStyle style = UDAT_STYLE_LONG;
|
||||
static std::unordered_map<std::string, URelativeDateTimeUnit> relativeUnits;
|
||||
|
@ -59,11 +59,7 @@ RelativeTimeFormat::RelativeTimeFormat(const std::vector<std::string> &localeTag
|
||||
localeInfo = new LocaleInfo(curLocale, configs);
|
||||
locale = localeInfo->GetLocale();
|
||||
localeBaseName = localeInfo->GetBaseName();
|
||||
numberFormat = icu::NumberFormat::createInstance(locale, UNUM_DECIMAL, status);
|
||||
if (numberFormat == nullptr) {
|
||||
continue;
|
||||
}
|
||||
relativeTimeFormat = new icu::RelativeDateTimeFormatter(locale, numberFormat, style,
|
||||
relativeTimeFormat = new icu::RelativeDateTimeFormatter(locale, nullptr, style,
|
||||
UDISPCTX_CAPITALIZATION_NONE, status);
|
||||
break;
|
||||
}
|
||||
@ -72,8 +68,7 @@ RelativeTimeFormat::RelativeTimeFormat(const std::vector<std::string> &localeTag
|
||||
localeInfo = new LocaleInfo(LocaleConfig::GetSystemLocale(), configs);
|
||||
locale = localeInfo->GetLocale();
|
||||
localeBaseName = localeInfo->GetBaseName();
|
||||
numberFormat = icu::NumberFormat::createInstance(locale, UNUM_DECIMAL, status);
|
||||
relativeTimeFormat = new icu::RelativeDateTimeFormatter(locale, numberFormat, style,
|
||||
relativeTimeFormat = new icu::RelativeDateTimeFormatter(locale, nullptr, style,
|
||||
UDISPCTX_CAPITALIZATION_NONE, status);
|
||||
}
|
||||
numberingSystem = localeInfo->GetNumberingSystem();
|
||||
@ -88,10 +83,6 @@ RelativeTimeFormat::~RelativeTimeFormat()
|
||||
delete localeInfo;
|
||||
localeInfo = nullptr;
|
||||
}
|
||||
if (numberFormat != nullptr) {
|
||||
delete numberFormat;
|
||||
numberFormat = nullptr;
|
||||
}
|
||||
if (relativeTimeFormat != nullptr) {
|
||||
delete relativeTimeFormat;
|
||||
relativeTimeFormat = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user