未验证 提交 c482ef59 编写于 作者: O openharmony_ci 提交者: Gitee

!227 修改Collator、PluralRules构造函数

Merge pull request !227 from sunyaozu/OpenHarmony-3.1-Release
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册