mirror of
https://github.com/openharmony/global_i18n_standard.git
synced 2026-07-01 21:54:06 -04:00
fix constructor of collator and pluralRules
Signed-off-by: sunyaozu <sunyaozu@huawei.com>
This commit is contained in:
@@ -66,9 +66,7 @@ Collator::Collator(std::vector<std::string> &localeTags, std::map<std::string, s
|
||||
ParseAllOptions(options);
|
||||
|
||||
UErrorCode status = UErrorCode::U_ZERO_ERROR;
|
||||
if (!localeTags.size()) {
|
||||
localeTags.push_back(LocaleConfig::GetSystemLocale());
|
||||
}
|
||||
localeTags.push_back(LocaleConfig::GetSystemLocale());
|
||||
for (size_t i = 0; i < localeTags.size(); i++) {
|
||||
std::string curLocale = localeTags[i];
|
||||
locale = icu::Locale::forLanguageTag(icu::StringPiece(curLocale), status);
|
||||
|
||||
@@ -81,9 +81,7 @@ void PluralRules::InitPluralRules(std::vector<std::string> &localeTags,
|
||||
{
|
||||
UPluralType uPluralType = (type == "cardinal") ? UPLURAL_TYPE_CARDINAL : UPLURAL_TYPE_ORDINAL;
|
||||
UErrorCode status = UErrorCode::U_ZERO_ERROR;
|
||||
if (!localeTags.size()) {
|
||||
localeTags.push_back(LocaleConfig::GetSystemLocale());
|
||||
}
|
||||
localeTags.push_back(LocaleConfig::GetSystemLocale());
|
||||
for (size_t i = 0; i < localeTags.size(); i++) {
|
||||
std::string curLocale = localeTags[i];
|
||||
locale = icu::Locale::forLanguageTag(icu::StringPiece(curLocale), status);
|
||||
@@ -95,6 +93,7 @@ void PluralRules::InitPluralRules(std::vector<std::string> &localeTags,
|
||||
if (status != UErrorCode::U_ZERO_ERROR || !pluralRules) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (status != UErrorCode::U_ZERO_ERROR || !pluralRules) {
|
||||
|
||||
Reference in New Issue
Block a user