From 998bbdcbf6b808570b4798e225f837fa40800a2e Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Mon, 2 Feb 2026 14:30:02 +0800 Subject: [PATCH] =?utf8?q?=E6=98=9F=E5=8E=86=E4=B8=8B=E8=BD=BD=E7=95=8C?= =?utf8?q?=E9=9D=A2=EF=BC=8C=E7=9C=81=E7=94=B5=E6=A8=A1=E5=BC=8F=E7=95=8C?= =?utf8?q?=E9=9D=A2=EF=BC=8C=E8=BF=90=E5=8A=A8=E8=AF=86=E5=88=AB=E7=95=8C?= =?utf8?q?=E9=9D=A2=EF=BC=8C=E5=8E=8B=E5=8A=9B=E6=B5=8B=E9=87=8F=E7=95=8C?= =?utf8?q?=E9=9D=A2=E4=B8=AD=E8=8B=B1=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../src/EphemerisDownloadModel.cpp | 19 ++++-- .../src/EphemerisDownloadPresenter.cpp | 23 ++++++-- .../src/EphemerisDownloadView.cpp | 57 ++++++++++++++---- .../src/MotionRecognitionView.cpp | 11 +++- .../nativeui/saveele/src/SaveEleView.cpp | 5 ++ .../stress/include/stressTestPresenter.h | 1 + .../stress/src/stressTestFailView.cpp | 58 +++++++++++++++---- .../nativeui/stress/src/stressTestModel.cpp | 24 ++++++-- .../stress/src/stressTestResultView.cpp | 50 +++++++++++++--- .../stress/src/stressTestStandbyView.cpp | 12 +++- .../nativeui/stress/src/stressTestingView.cpp | 12 +++- 11 files changed, 222 insertions(+), 50 deletions(-) diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadModel.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadModel.cpp index f9bceac13..f591ab898 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadModel.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadModel.cpp @@ -7,6 +7,7 @@ #include "wearable_log.h" #include "cmsis_os.h" #include "service/graphic_service.h" +#include "ConfigModel.h" #if defined(SUPPORT_GNSS) #include "gnss_http_server.h" @@ -108,11 +109,21 @@ std::string EphemerisDownloadModel::GetEphemerisValidityPeriod() { int days = validityPeriod / (24 * 60); int hours = (validityPeriod % (24 * 60)) / 60; int minutes = validityPeriod % 60; - ephemerisValidityPeriod = std::to_string(days) + "天" + - std::to_string(hours) + "小时" + - std::to_string(minutes) + "分钟"; + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + ephemerisValidityPeriod = std::to_string(days) + "天" + + std::to_string(hours) + "小时" + + std::to_string(minutes) + "分钟"; + else + ephemerisValidityPeriod = std::to_string(days) + " days " + + std::to_string(hours) + " hours " + + std::to_string(minutes) + " minutes"; } else { - ephemerisValidityPeriod = "无优化数据"; + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + ephemerisValidityPeriod = "无优化数据"; + else + ephemerisValidityPeriod = "No optimization data"; } #endif return ephemerisValidityPeriod; diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadPresenter.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadPresenter.cpp index c7b5d7532..7397d4c83 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadPresenter.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadPresenter.cpp @@ -13,6 +13,7 @@ #include "NativeRegisterManager.h" #include "wearable_log.h" #include "ui_resource_string.h" +#include "ConfigModel.h" #ifdef SUPPORT_BLE_SERVICE #include "bleEvent.h" @@ -113,12 +114,17 @@ void EphemerisDownloadPresenter::UpdateDownloadStatus() { //显示下载进度等 if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() == -1) { - EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText( - "优化失败"); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText("优化失败"); + else + EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText("Optimization Failed"); } else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() == 0) { - EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText("正在链接网络"); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText("正在链接网络"); + else + EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText("Connecting to Network"); //设置下载按键 EphemerisDownloadView::GetInstance()->UpdateDownloadButton(); } @@ -149,8 +155,10 @@ void EphemerisDownloadPresenter::UpdateDownloadStatus() { case EphemerisDownloadStatus::DOWNLOADED: if (EphemerisDownloadView::GetInstance()) { if (EphemerisDownloadView::GetInstance()->GetDownloadLabel()) { - EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText( - "优化成功"); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText("优化成功"); + else + EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText("Optimization Successful"); //设置下载按键 EphemerisDownloadView::GetInstance()->UpdateDownloadButton(); } @@ -164,7 +172,10 @@ void EphemerisDownloadPresenter::UpdateDownloadStatus() { case EphemerisDownloadStatus::FAILED: if (EphemerisDownloadView::GetInstance()) { if (EphemerisDownloadView::GetInstance()->GetDownloadLabel()) { - EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText("优化失败"); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText("优化失败"); + else + EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText("Optimization Failed"); } //设置下载按键 EphemerisDownloadView::GetInstance()->UpdateDownloadButton(); diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadView.cpp index 9fcadbd53..db03eac64 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadView.cpp @@ -8,6 +8,8 @@ #include "wearable_log.h" #include "UiConfig.h" #include "uicomponents/UIComponents.h" +#include "ConfigModel.h" + namespace OHOS { @@ -106,7 +108,10 @@ bool EphemerisDownloadView::EphemerisDownloadInit() { } labelTitle_->SetPosition(83, 50, 300, 50); labelTitle_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - labelTitle_->SetText("定位优化"); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + labelTitle_->SetText("定位优化"); + else + labelTitle_->SetText("Location Optimization"); labelTitle_->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); labelTitle_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); labelTitle_->SetTextColor(Color::White()); @@ -121,7 +126,10 @@ bool EphemerisDownloadView::EphemerisDownloadInit() { labelStatus_->SetPosition(50, 120, 360, 70); labelStatus_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); labelStatus_->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); - labelStatus_->SetText("● 优化状态:"); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + labelStatus_->SetText("● 优化状态:"); + else + labelStatus_->SetText("● Optimization Status:"); labelStatus_->SetTextColor(Color::Yellow());//黄色 group->Add(labelStatus_); @@ -145,7 +153,10 @@ bool EphemerisDownloadView::EphemerisDownloadInit() { labelValidity_->SetPosition(50, 170, 360, 70); labelValidity_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); labelValidity_->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); - labelValidity_->SetText("● 有效期:"); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + labelValidity_->SetText("● 有效期:"); + else + labelValidity_->SetText("● Expiration Date:"); labelValidity_->SetTextColor(Color::Green());//绿色 group->Add(labelValidity_); @@ -169,7 +180,10 @@ bool EphemerisDownloadView::EphemerisDownloadInit() { labelNote_->SetPosition(50, 230, 366, 80); labelNote_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20); labelNote_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - labelNote_->SetText("注:需要在网络连接状态下并且有效期失效时才可以下载"); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + labelNote_->SetText("注:需要在网络连接状态下并且有效期失效时才可以下载"); + else + labelNote_->SetText("Note: You can only download when the network is connected and the expiration date is invalid."); labelNote_->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff)); // 灰色 //修改为靠左对齐 labelNote_->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); @@ -177,7 +191,10 @@ bool EphemerisDownloadView::EphemerisDownloadInit() { InitButtonExt(btnDownload_, 58, 320, 170, 90, DOWNLOAD_ID, STR_EPHEMERIS_DOWNLOAD, 30); btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); // 设置按键颜色 - btnDownload_->SetText("优化"); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + btnDownload_->SetText("优化"); + else + btnDownload_->SetText("Optimized"); btnDownload_->SetOnClickListener(presenter_); InitButtonExt(btnBack_, 238, 320, 170, 90, BACK_ID, STR_CANCEL, 30); btnBack_->SetStyle(STYLE_BACKGROUND_COLOR, 0xffFF8A36); // 设置按键颜色 @@ -215,7 +232,10 @@ void EphemerisDownloadView::UpdateDownloadStatus() { EphemerisDownloadModel::GetInstance().SetEphemerisDownloadStatus(EphemerisDownloadStatus::DOWNLOADED); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UpdateDownloadStatus: 同步状态为已下载"); } - labelStatusValue_->SetText("已优化"); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + labelStatusValue_->SetText("已优化"); + else + labelStatusValue_->SetText("Optimized"); } else { @@ -225,7 +245,10 @@ void EphemerisDownloadView::UpdateDownloadStatus() { EphemerisDownloadModel::GetInstance().SetEphemerisDownloadStatus(EphemerisDownloadStatus::NOT_DOWNLOADED); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UpdateDownloadStatus: 同步状态为未下载"); } - labelStatusValue_->SetText("未优化"); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + labelStatusValue_->SetText("未优化"); + else + labelStatusValue_->SetText("Not Optimized"); } } @@ -235,7 +258,10 @@ void EphemerisDownloadView::UpdateValidityPeriod() { std::string period = EphemerisDownloadModel::GetInstance().GetEphemerisValidityPeriod(); if (period.empty()) { - labelValidityValue_->SetText("未优化"); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + labelValidityValue_->SetText("未优化"); + else + labelValidityValue_->SetText("Not Optimized"); } else { labelValidityValue_->SetText(period.c_str()); } @@ -250,17 +276,26 @@ void EphemerisDownloadView::UpdateDownloadButton() { switch (status) { case EphemerisDownloadStatus::NOT_DOWNLOADED: case EphemerisDownloadStatus::FAILED: - btnDownload_->SetText("点击优化"); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + btnDownload_->SetText("点击优化"); + else + btnDownload_->SetText("Click to Optimize"); btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Blue().full); // 蓝色 btnDownload_->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0xcc, 0x70, 0x00, 0xff).full, UIButton::PRESSED); break; case EphemerisDownloadStatus::DOWNLOADING: - btnDownload_->SetText("优化中"); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + btnDownload_->SetText("优化中"); + else + btnDownload_->SetText("Optimizing"); btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full); // 灰色 btnDownload_->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0x44, 0x44, 0x44, 0xff).full, UIButton::PRESSED); break; case EphemerisDownloadStatus::DOWNLOADED: - btnDownload_->SetText("已优化"); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + btnDownload_->SetText("已优化"); + else + btnDownload_->SetText("Optimized"); // btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Green().full); // 绿色 btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full); // 灰色 btnDownload_->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0x44, 0x44, 0x44, 0xff).full, UIButton::PRESSED); diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/motionrecognition/src/MotionRecognitionView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/motionrecognition/src/MotionRecognitionView.cpp index fc2c9d913..8564bb5a0 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/motionrecognition/src/MotionRecognitionView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/motionrecognition/src/MotionRecognitionView.cpp @@ -156,8 +156,15 @@ namespace OHOS note->SetStyle(STYLE_TEXT_FONT, 20); note->SetStyle(STYLE_LINE_HEIGHT, 40); note->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff)); - note->SetTextId(STR_MOTION_RECOGNITION_NOTE);//开启后,手表会在检测到你处于运动状态时发出提醒。支持的运动包括:走路、跑步、骑车、划船机、椭圆机。 - note->SetText("开启后,手表会在检测到你处于运动状态时发出提醒。支持的运动包括:走路、跑步、划船机、椭圆机。"); + // note->SetTextId(STR_MOTION_RECOGNITION_NOTE);//开启后,手表会在检测到你处于运动状态时发出提醒。支持的运动包括:走路、跑步、骑车、划船机、椭圆机。 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + { + note->SetText("开启后,手表会在检测到你处于运动状态时发出提醒。支持的运动包括:走路、跑步、骑车、划船机、椭圆机。"); + } + else + { + note->SetText("When enabled, the watch will send a reminder when it detects that you are in a sports state. Supported sports include: walking, running, cycling, rowing machine, elliptical trainer."); + } note->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); note->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20); /* -------------------------------------------------------------------------- */ diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/saveele/src/SaveEleView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/saveele/src/SaveEleView.cpp index 52e1491d9..e245186da 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/saveele/src/SaveEleView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/saveele/src/SaveEleView.cpp @@ -16,6 +16,7 @@ #include "ui_resource_image.h" #include "ui_resource_string.h" #include "uicomponents/UIComponents.h" +#include "ConfigModel.h" namespace OHOS { @@ -74,7 +75,11 @@ void SaveEleView::InitView() { // TODO:多国语言 InitLabelExt(labelnote, 53, 217, 360, 200, "labletitle", STR_SAVENOTE, DEFAULT_VECTOR_FONT_FILENAME, 30); + + if(ConfigModel::GetInstance()->GetLanguage() == 0) labelnote->SetText("开启省电模式会关闭非必要的蓝牙连接,以及传感器监测等功能"); + else + labelnote->SetText("Enabling power-saving mode will turn off non-essential Bluetooth connections and functions such as sensor monitoring."); labelnote->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); InitLabelExt(labelkown, 53, labelnote->GetY() + labelnote->GetHeight() + 20, diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/include/stressTestPresenter.h b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/include/stressTestPresenter.h index b5e94646b..cfa28fbce 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/include/stressTestPresenter.h +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/include/stressTestPresenter.h @@ -8,6 +8,7 @@ #include "stress/include/stressTestUIConfig.h" #include "iostream" #include +#include "ConfigModel.h" namespace OHOS { class StressTestMainView; diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestFailView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestFailView.cpp index 9380e8430..31838322d 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestFailView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestFailView.cpp @@ -114,7 +114,11 @@ namespace OHOS return nullptr; } titleLabel->SetPosition(83, 50, 300, 35); - titleLabel->SetText("检测不到结果"); + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + titleLabel->SetText("检测不到结果"); + else + titleLabel->SetText("No result detected"); titleLabel->SetStyle(STYLE_BACKGROUND_OPA, 0xff); titleLabel->SetStyle(STYLE_TEXT_FONT, 30); titleLabel->SetStyle(STYLE_LINE_HEIGHT, 35); @@ -144,12 +148,19 @@ namespace OHOS return nullptr; } error1DescriptionLabel->SetPosition(33, 208, 400, 105); - error1DescriptionLabel->SetText("请确认已带上手表,并保持静止,准备好后点击下方按钮进行重新检测"); + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + error1DescriptionLabel->SetText("请确认已带上手表,并保持静止,准备好后点击下方按钮进行重新检测"); + else + error1DescriptionLabel->SetText("Please confirm the watch is worn, stay still, and tap the button below to retest when ready."); error1DescriptionLabel->SetStyle(STYLE_TEXT_FONT, 30); error1DescriptionLabel->SetStyle(STYLE_LINE_HEIGHT, 35); error1DescriptionLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); error1DescriptionLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - error1DescriptionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + error1DescriptionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + else + error1DescriptionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26); error1DescriptionLabel->SetTextColor(Color::GetColorFromRGBA(0xcc, 0xcc, 0xcc, 0xff)); scrollView->Add(error1DescriptionLabel); } @@ -162,7 +173,11 @@ namespace OHOS return nullptr; } retryTestButton->SetPosition(118, 334, 230, 80); - retryTestButton->SetText("重试检测"); + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + retryTestButton->SetText("重试检测"); + else + retryTestButton->SetText("Retry test"); retryTestButton->SetAlign(TEXT_ALIGNMENT_CENTER); retryTestButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); retryTestButton->SetViewId(RETRY_TEST_BUTTON_ID); @@ -181,7 +196,11 @@ namespace OHOS return nullptr; } stopTestButton->SetPosition(118, 434, 230, 80); - stopTestButton->SetText("停止检测"); + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + stopTestButton->SetText("停止检测"); + else + stopTestButton->SetText("Stop test"); stopTestButton->SetAlign(TEXT_ALIGNMENT_CENTER); stopTestButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); stopTestButton->SetViewId(STOP_TEST_BUTTON_ID); @@ -234,7 +253,11 @@ namespace OHOS return nullptr; } titleLabel->SetPosition(83, 50, 300, 35); - titleLabel->SetText("检测不到结果"); + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + titleLabel->SetText("检测不到结果"); + else + titleLabel->SetText("No result detected"); titleLabel->SetStyle(STYLE_BACKGROUND_OPA, 0xff); titleLabel->SetStyle(STYLE_TEXT_FONT, 30); titleLabel->SetStyle(STYLE_LINE_HEIGHT, 35); @@ -264,12 +287,19 @@ namespace OHOS return nullptr; } error1DescriptionLabel->SetPosition(53, 210, 360, 70); - error1DescriptionLabel->SetText("请确认已带上手表,并保持静止"); + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + error1DescriptionLabel->SetText("请确认已带上手表,并保持静止"); + else + error1DescriptionLabel->SetText("Please confirm the watch is worn and stay still."); error1DescriptionLabel->SetStyle(STYLE_TEXT_FONT, 30); error1DescriptionLabel->SetStyle(STYLE_LINE_HEIGHT, 35); error1DescriptionLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); error1DescriptionLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - error1DescriptionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + error1DescriptionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + else + error1DescriptionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26); error1DescriptionLabel->SetTextColor(Color::GetColorFromRGBA(0xcc, 0xcc, 0xcc, 0xff)); scrollView->Add(error1DescriptionLabel); } @@ -282,7 +312,11 @@ namespace OHOS return nullptr; } retryButton->SetPosition(238, 300, 170, 90); - retryButton->SetText("重测"); + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + retryButton->SetText("重测"); + else + retryButton->SetText("Retry test"); retryButton->SetAlign(TEXT_ALIGNMENT_CENTER); retryButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); retryButton->SetViewId(RETRY_BUTTON_ID); @@ -301,7 +335,11 @@ namespace OHOS return nullptr; } stopButton->SetPosition(58, 300, 170, 90); - stopButton->SetText("停止"); + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + stopButton->SetText("停止"); + else + stopButton->SetText("Stop test"); stopButton->SetAlign(TEXT_ALIGNMENT_CENTER); stopButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); stopButton->SetViewId(STOP_BUTTON_ID); diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestModel.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestModel.cpp index 5488fc45a..17dffb01d 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestModel.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestModel.cpp @@ -321,16 +321,32 @@ namespace OHOS switch (resultType) { case RESULT_TYPE_OVERLOAD: - resultStr = std::string("压力过载 ") + resultValueStr; + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + resultStr = std::string("压力过载 ") + resultValueStr; + else + resultStr = std::string("Stress overload ") + resultValueStr; break; case RESULT_TYPE_WARNING: - resultStr = std::string("注意压力 ") + resultValueStr; + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + resultStr = std::string("注意压力 ") + resultValueStr; + else + resultStr = std::string("Warning stress level ") + resultValueStr; break; case RESULT_TYPE_NORMAL: - resultStr = std::string("状态正常 ") + resultValueStr; + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + resultStr = std::string("状态正常 ") + resultValueStr; + else + resultStr = std::string("Normal stress level ") + resultValueStr; break; case RESULT_TYPE_EXCELLENT: - resultStr = std::string("状态优秀 ") + resultValueStr; + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + resultStr = std::string("状态优秀 ") + resultValueStr; + else + resultStr = std::string("Excellent stress level ") + resultValueStr; break; default: break; diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestResultView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestResultView.cpp index a84f8470a..f2060dfa6 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestResultView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestResultView.cpp @@ -81,14 +81,22 @@ namespace OHOS { resultImageView->SetSrc(STRESS_TEST_RESULT_VIEW_RESULT_IMAGE_1); backgroundImageView->SetSrc(STRESS_TEST_RESULT_VIEW_BACKGROUND_IMAGE_1); - descriptionLabel->SetText("当前压力过高,建议暂停工作,进行呼吸训练或冥想"); + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + descriptionLabel->SetText("当前压力过高,建议暂停工作,进行呼吸训练或冥想"); + else + descriptionLabel->SetText("High stress detected. Pause work, practice breathing exercises or meditation."); ValueNamesLabel->SetTextColor(Color::GetColorFromRGBA(0xfd, 0x52, 0x13, 0xff)); } else if (resultType == StressTestModel::RESULT_TYPE_WARNING) { resultImageView->SetSrc(STRESS_TEST_RESULT_VIEW_RESULT_IMAGE_2); backgroundImageView->SetSrc(STRESS_TEST_RESULT_VIEW_BACKGROUND_IMAGE_2); - descriptionLabel->SetText("存在轻微压力,建议试试1分钟深呼吸或远眺"); + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + descriptionLabel->SetText("存在轻微压力,建议试试1分钟深呼吸或远眺"); + else + descriptionLabel->SetText("Mild stress detected. Try 1-minute deep breathing or eye relaxation."); ValueNamesLabel->SetTextColor(Color::GetColorFromRGBA(0xff, 0x8e, 0x1a, 0xff)); } @@ -96,13 +104,21 @@ namespace OHOS { resultImageView->SetSrc(STRESS_TEST_RESULT_VIEW_RESULT_IMAGE_3); backgroundImageView->SetSrc(STRESS_TEST_RESULT_VIEW_BACKGROUND_IMAGE_3); - descriptionLabel->SetText("压力在健康范围,建议继续保持规律作息,状态良好"); + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + descriptionLabel->SetText("压力在健康范围,建议继续保持规律作息,状态良好"); + else + descriptionLabel->SetText("Stress in healthy range. Keep regular routine and good state."); ValueNamesLabel->SetTextColor(Color::GetColorFromRGBA(0x0f, 0xaf, 0xff, 0xff)); } else if (resultType == StressTestModel::RESULT_TYPE_EXCELLENT) { resultImageView->SetSrc(STRESS_TEST_RESULT_VIEW_RESULT_IMAGE_4); - descriptionLabel->SetText("当前压力极低,建议保持当前状态,享受放松时刻"); + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + descriptionLabel->SetText("当前压力极低,建议保持当前状态,享受放松时刻"); + else + descriptionLabel->SetText("Stress level is very low. Keep the current state and enjoy the relaxing moment."); backgroundImageView->SetSrc(STRESS_TEST_RESULT_VIEW_BACKGROUND_IMAGE_4); ValueNamesLabel->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xce, 0x4c, 0xff)); } @@ -169,7 +185,11 @@ namespace OHOS return nullptr; } titleLabel->SetPosition(83, 50, 300, 35); - titleLabel->SetText("压力"); + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + titleLabel->SetText("压力"); + else + titleLabel->SetText("Stress Level"); titleLabel->SetStyle(STYLE_BACKGROUND_OPA, 0xff); titleLabel->SetStyle(STYLE_TEXT_FONT, 30); titleLabel->SetStyle(STYLE_LINE_HEIGHT, 35); @@ -203,11 +223,23 @@ namespace OHOS return nullptr; } descriptionLabel->SetPosition(53, 315, 360, 70); - descriptionLabel->SetText("压力在健康范围,建议继续保持规律作息,状态良好"); - descriptionLabel->SetStyle(STYLE_TEXT_FONT, 30); - descriptionLabel->SetStyle(STYLE_LINE_HEIGHT, 35); + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + { + descriptionLabel->SetStyle(STYLE_TEXT_FONT, 30); + descriptionLabel->SetStyle(STYLE_LINE_HEIGHT, 35); + descriptionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + descriptionLabel->SetText("压力在健康范围,建议继续保持规律作息,状态良好"); + } + else + { + descriptionLabel->SetStyle(STYLE_TEXT_FONT, 26); + descriptionLabel->SetStyle(STYLE_LINE_HEIGHT, 30); + descriptionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26); + descriptionLabel->SetText("Stress within healthy range. Keep regular routine and maintain good state."); + } + descriptionLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); descriptionLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); - descriptionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); scrollView->Add(descriptionLabel); } diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestStandbyView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestStandbyView.cpp index 7780ba4a9..fc376ed3b 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestStandbyView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestStandbyView.cpp @@ -109,7 +109,11 @@ namespace OHOS return nullptr; } titleLabel->SetPosition(83, 50, 300, 35); - titleLabel->SetText("压力"); + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + titleLabel->SetText("压力"); + else + titleLabel->SetText("Stress"); titleLabel->SetStyle(STYLE_BACKGROUND_OPA, 0xff); titleLabel->SetStyle(STYLE_TEXT_FONT, 30); titleLabel->SetStyle(STYLE_LINE_HEIGHT, 35); @@ -156,7 +160,11 @@ namespace OHOS return nullptr; } startTestButton->SetPosition(93, 330, 280, 90); - startTestButton->SetText("检测"); + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + startTestButton->SetText("检测"); + else + startTestButton->SetText("Start test"); startTestButton->SetAlign(TEXT_ALIGNMENT_CENTER); startTestButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); startTestButton->SetViewId(START_TEST_BUTTON_ID); diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestingView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestingView.cpp index d7ae977d6..984a2dd14 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestingView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestingView.cpp @@ -134,7 +134,11 @@ namespace OHOS return nullptr; } titleLabel->SetPosition(83, 50, 300, 35); - titleLabel->SetText("压力"); + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + titleLabel->SetText("压力"); + else + titleLabel->SetText("Stress Testing"); titleLabel->SetStyle(STYLE_BACKGROUND_OPA, 0xff); titleLabel->SetStyle(STYLE_TEXT_FONT, 30); titleLabel->SetStyle(STYLE_LINE_HEIGHT, 35); @@ -153,7 +157,11 @@ namespace OHOS return nullptr; } cancelButton->SetPosition(93, 330, 280, 90); - cancelButton->SetText("取消检测"); + //根据语言选择显示格式 + if(ConfigModel::GetInstance()->GetLanguage() == 0) + cancelButton->SetText("取消检测"); + else + cancelButton->SetText("Cancel Testing"); cancelButton->SetAlign(TEXT_ALIGNMENT_CENTER); cancelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); cancelButton->SetViewId(CANCEL_BUTTON_ID); -- 2.17.1