for icu:::Locale

Signed-off-by: hwzjq <junquan.zhou@huawei.com>
This commit is contained in:
hwzjq 2021-07-27 22:55:21 +08:00
parent d09cf4dfdd
commit fba23c2680
5 changed files with 21 additions and 19 deletions

View File

@ -60,8 +60,8 @@ config("ace_config") {
]
if (is_standard_system) {
include_dirs += [
"//base/global/resmgr_standard/frameworks/resmgr/include",
"//base/global/resmgr_standard/interfaces/innerkits/include",
"//third_party/icu/icu4c/source/common",
]
}
defines = ace_common_defines
@ -113,8 +113,8 @@ config("ace_test_config") {
]
if (is_standard_system) {
include_dirs += [
"//base/global/resmgr_standard/frameworks/resmgr/include",
"//base/global/resmgr_standard/interfaces/innerkits/include",
"//third_party/icu/icu4c/source/common",
]
}
defines = ace_common_defines

View File

@ -39,12 +39,15 @@ template("ace_base_platform_source_set") {
deps = [
"$flutter_root:ace_skia_$platform",
"//base/global/resmgr_standard/frameworks/resmgr:global_resmgr",
"//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native",
"//foundation/graphic/standard:libwms_client",
"//third_party/zlib:libz",
]
public_deps = [
"//base/global/resmgr_standard/frameworks/resmgr:global_resmgr",
]
external_deps = [
"aafwk_standard:ability_manager",
"aafwk_standard:want",

View File

@ -23,7 +23,6 @@
#include "init_data.h"
#include "touch_event.h"
#include "locale_info.h"
#include "res_config.h"
#include "resource_manager.h"
@ -127,9 +126,9 @@ void AceAbility::OnStart(const Want& want)
auto localeInfo = resConfig->GetLocaleInfo();
AceApplicationInfo::GetInstance().SetResourceManager(resourceManager);
if (localeInfo != nullptr) {
auto language = localeInfo->GetLanguage();
auto region = localeInfo->GetRegion();
auto script = localeInfo->GetScript();
auto language = localeInfo->getLanguage();
auto region = localeInfo->getCountry();
auto script = localeInfo->getScript();
AceApplicationInfo::GetInstance().SetLocale(
(language == nullptr) ? "" : language,
(region == nullptr) ? "" : region,

View File

@ -69,7 +69,7 @@ void AceApplicationInfoImpl::ChangeLocale(const std::string& language, const std
return;
}
auto script = localeInfo->GetScript();
auto script = localeInfo->getScript();
resConfig->SetLocaleInfo(languageLower.c_str(), script, countryOrRegionUpper.c_str());
resourceManager_->UpdateResConfig(*resConfig);

View File

@ -33,8 +33,8 @@ const char BLOCK_VALUE[] = "blockValue";
const std::string REPEAT_INDEX = "$idx";
const std::string REPEAT_ITEM = "$item";
const std::string TRUE = "true";
const std::string FALSE = "false";
const std::string TRUE_STR = "true";
const std::string FALSE_STR = "false";
std::unique_ptr<JsonValue> GetJsonValue(
const std::vector<std::string>& keys, const std::unique_ptr<JsonValue>& fileData)
@ -599,7 +599,7 @@ bool JsCardParser::GetShownValue(std::string& value)
return false;
}
}
value = showValue ? TRUE : FALSE;
value = showValue ? TRUE_STR : FALSE_STR;
return true;
}
@ -1147,11 +1147,11 @@ void JsCardParser::UpdateDomNode(const RefPtr<Framework::JsAcePage>& page, const
auto attrCommand = Referenced::MakeRefPtr<JsCommandUpdateDomElementAttrs>(selfId);
auto ptr = Referenced::RawPtr(attrCommand);
if (shouldShow && hasShownAttr) {
attrs.emplace_back(std::make_pair("show", TRUE));
attrs.emplace_back(std::make_pair("show", TRUE_STR));
}
ParseAttributes(rootJson, selfId, attrs, (JsCommandDomElementOperator*)ptr);
if (!shouldShow && hasShownAttr) {
attrs.emplace_back(std::make_pair("show", FALSE));
attrs.emplace_back(std::make_pair("show", FALSE_STR));
}
ParseStyles(rootJson, selfId, styles);
ParseEvents(rootJson, events, page, selfId);
@ -1211,7 +1211,7 @@ bool JsCardParser::ParseTernaryExpression(std::string& value)
return false;
}
GetVariable(flagStr[0]);
auto flag = flagStr[0] == TRUE;
auto flag = flagStr[0] == TRUE_STR;
std::vector<std::string> keyStr;
StringUtils::SplitStr(flagStr[1], ":", keyStr);
@ -1236,7 +1236,7 @@ bool JsCardParser::ParseLogicalExpression(std::string& value)
}
GetVariable(splitStr[0]);
GetVariable(splitStr[1]);
value = (splitStr[0] == TRUE && splitStr[1] == TRUE) ? TRUE : FALSE;
value = (splitStr[0] == TRUE_STR && splitStr[1] == TRUE_STR) ? TRUE_STR : FALSE_STR;
return true;
} else if (value.find("||") != std::string::npos) {
// for {{flag1 || flag2}}.
@ -1246,7 +1246,7 @@ bool JsCardParser::ParseLogicalExpression(std::string& value)
}
GetVariable(splitStr[0]);
GetVariable(splitStr[1]);
value = (splitStr[0] == TRUE || splitStr[1] == TRUE) ? TRUE : FALSE;
value = (splitStr[0] == TRUE_STR || splitStr[1] == TRUE_STR) ? TRUE_STR : FALSE_STR;
return true;
} else if (value.find('!') != std::string::npos) {
// for {{!flag1}}.
@ -1255,7 +1255,7 @@ bool JsCardParser::ParseLogicalExpression(std::string& value)
return false;
}
GetVariable(splitStr[0]);
value = splitStr[0] == TRUE ? FALSE : TRUE;
value = splitStr[0] == TRUE_STR ? FALSE_STR : TRUE_STR;
return true;
}
return false;
@ -1394,11 +1394,11 @@ void JsCardParser::CreateDomNode(const RefPtr<Framework::JsAcePage>& page, const
command->SetPipelineContext(context_);
auto ptr = Referenced::RawPtr(command);
if (shouldShow && hasShownAttr) {
attrs.emplace_back(std::make_pair("show", TRUE));
attrs.emplace_back(std::make_pair("show", TRUE_STR));
}
ParseAttributes(rootJson, nodeId, attrs, (Framework::JsCommandDomElementOperator*)ptr);
if (!shouldShow && hasShownAttr) {
attrs.emplace_back(std::make_pair("show", FALSE));
attrs.emplace_back(std::make_pair("show", FALSE_STR));
}
LOGD("card nodeId: %d, parentId: %d, type: %s", nodeId, parentId, type.c_str());
ParseStyles(rootJson, nodeId, styles);