● 呼吸训练多国语言适配 1105/3 1105/head 1106/target/1
authorluozheng <1732036298@qq.com>
Sat, 5 Oct 2024 04:59:17 +0000 (12:59 +0800)
committerluozheng <1732036298@qq.com>
Sat, 5 Oct 2024 04:59:17 +0000 (12:59 +0800)
● 4G界面多国语言适配,
● 运动识别多国语言适配

code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp
code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallView.cpp
code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/include/RespiratoryTrainingPresenter.h
code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingDurationSelectionView.cpp
code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingView.cpp

index 6382323..43bf4b8 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-23 17:28:52
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-09-14 16:14:37
+ * @LastEditTime: 2024-10-05 12:41:35
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp
  */
 #include "motionrecognition/include/MotionRecognitionPresenter.h"
@@ -152,7 +152,7 @@ namespace OHOS
             note->SetStyle(STYLE_TEXT_FONT, 26);
             note->SetStyle(STYLE_LINE_HEIGHT, 40);
             note->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));
-            note->SetText("开启后,手表会在检测到你处于运动状态时发出提醒。支持的运动包括:走路、跑步、骑车、划船机、椭圆机。"); /*自动识别*/
+            note->SetTextId(STR_MOTION_RECOGNITION_NOTE);//开启后,手表会在检测到你处于运动状态时发出提醒。支持的运动包括:走路、跑步、骑车、划船机、椭圆机。
             note->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
             note->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);
             /* -------------------------------------------------------------------------- */
index aa54db7..28a0412 100644 (file)
@@ -195,7 +195,7 @@ namespace OHOS
             }
             note->SetStyle(STYLE_TEXT_FONT, 26);
             note->SetStyle(STYLE_LINE_HEIGHT, 40);
-            note->SetText("开启此功能后,手表可以4G SIM卡拨打电话,耗电会增加。");
+            note->SetTextId(STR_4G_NOTE);//开启此功能后,手表可以4G SIM卡拨打电话,耗电会增加。
             note->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));
             note->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
             note->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER);
index 7ae41b7..913e5fe 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-06-08 09:36:33
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-10-04 18:26:41
+ * @LastEditTime: 2024-10-05 12:29:42
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/include/RespiratoryTrainingPresenter.h
  */
 
@@ -32,7 +32,7 @@ namespace OHOS
 
         static RespiratoryTrainingPresenter *GetInstance();
 
-        std::string GetRespiratoryTrainingSelectTime();
+        int GetRespiratoryTrainingSelectTime();
         std::string GetRespiratoryTrainingSelectTime1();
 
     private:
index ea0517e..8935049 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-09-29 15:57:59
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-10-04 20:24:42
+ * @LastEditTime: 2024-10-05 12:34:35
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingDurationSelectionView.cpp
  */
 #include "respiratorytraining/include/RespiratoryTrainingDurationSelectionView.h"
@@ -11,6 +11,7 @@
 #include "wearable_log.h"
 #include "UiConfig.h"
 #include "dock/focus_manager.h"
+#include "ui_resource_string.h"
 namespace OHOS
 {
 
@@ -64,8 +65,8 @@ namespace OHOS
         label->SetPosition(labelconfig.left, labelconfig.top, labelconfig.width, labelconfig.height);
         label->SetStyle(STYLE_TEXT_FONT, labelconfig.fontSize);
         label->SetStyle(STYLE_LINE_HEIGHT, labelconfig.lineHeigh);
-        // label->SetTextId(labelconfig.textId);
-        label->SetText(labelconfig.text);
+        label->SetTextId(labelconfig.textId);
+        // label->SetText(labelconfig.text);
         label->SetLineBreakMode(labelconfig.lineBreakMode);
         label->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER);
         label->SetRollSpeed(70);
@@ -134,7 +135,7 @@ namespace OHOS
                 return nullptr;
             }
             TitleLabel->SetPosition(83, 50, 300, 35);
-            TitleLabel->SetText("时长设置"); // 时长设置
+            TitleLabel->SetTextId(STR_DURATION_SETTINGS); // 时长设置
             TitleLabel->SetStyle(STYLE_TEXT_FONT, 30);
             TitleLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
             TitleLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
@@ -167,8 +168,8 @@ namespace OHOS
                 scrollView->Add(DurationButton[i]);
             }
             /* -------------------------------------------------------------------------- */
-            // int16_t textId[MAX_NUM_TRAINING_DURATION] = {STR_1_MIN, STR_CELLULAR_DISPLAY, STR_5_MIN};
-            const char *text[MAX_NUM_TRAINING_DURATION] = {"1分钟", "2分钟", "3分钟", "4分钟", "5分钟"};
+            int16_t textId[MAX_NUM_TRAINING_DURATION] = {STR_1_MIN, STR_2_MIN,STR_3_MIN,STR_4_MIN, STR_5_MIN};
+            // const char *text[MAX_NUM_TRAINING_DURATION] = {"1分钟", "2分钟", "3分钟", "4分钟", "5分钟"};
             LabelConfig labelConfig = {
                 .left = 103,
                 .top = 153,
@@ -182,8 +183,8 @@ namespace OHOS
             for (int16_t i = 0; i < MAX_NUM_TRAINING_DURATION; i++)
             {
                 labelConfig.top = 153 + 120 * i;
-                // labelConfig.textId = textId[i];
-                labelConfig.text = text[i];
+                labelConfig.textId = textId[i];
+                // labelConfig.text = text[i];
                 DurationLabel[i] = LabelViewinit(labelConfig);
                 if (DurationLabel[i] == nullptr)
                 {
index ecbd147..7390274 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-05-07 11:26:06
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-10-04 18:05:11
+ * @LastEditTime: 2024-10-05 12:30:08
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/RespiratoryTraining/src/RespiratoryTrainingPresenter.cpp
  */
 
@@ -18,6 +18,7 @@
 #include "respiratorytraining/include/RespiratoryTrainingModel.h"
 #include "gfx_utils/mem_check.h"
 #include "map"
+#include "ui_resource_string.h"
 namespace OHOS
 {
 
@@ -145,32 +146,32 @@ namespace OHOS
         return true;
     }
 
-    std::string RespiratoryTrainingPresenter::GetRespiratoryTrainingSelectTime()
+    int RespiratoryTrainingPresenter::GetRespiratoryTrainingSelectTime()
     {
         int time = RespiratoryTrainingModel::GetInstance().GetRespiratoryTrainingSelectTime();
-        std::string text;
+        int textId;
         switch (time)
         {
         case 1:
-            text = "1分钟 >";
+            textId = STR_ONE_MIN;
             break;
         case 2:
-            text = "2分钟 >";
+            textId = STR_TWO_MIN;
             break;
         case 3:
-            text = "3分钟 >";
+            textId = STR_THREE_MIN;
             break;
         case 4:
-            text = "4分钟 >";
+            textId = STR_FOUR_MIN;
             break;
         case 5:
-            text = "5分钟 >";
+            textId = STR_FIVE_MIN;
             break;
         default:
-            text = "1分钟 >";
+            textId = STR_TWO_MIN;
             break;
         }
-        return text;
+        return textId;
     }
 
     std::string RespiratoryTrainingPresenter::GetRespiratoryTrainingSelectTime1()
index a6e39d6..8e5f8d0 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-05-07 11:25:58
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-10-04 18:26:22
+ * @LastEditTime: 2024-10-05 12:37:07
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/RespiratoryTraining/src/RespiratoryTrainingView.cpp
  */
 
@@ -48,7 +48,8 @@ namespace OHOS
         }
         if (TrainingDurationSelectiontitlelabel)
         {
-            TrainingDurationSelectiontitlelabel->SetText(presenter_->GetRespiratoryTrainingSelectTime().c_str());
+            TrainingDurationSelectiontitlelabel->SetTextId(presenter_->GetRespiratoryTrainingSelectTime());
+            TrainingDurationSelectiontitlelabel->ForceResetText();
         }
         return true;
     }
@@ -372,7 +373,7 @@ namespace OHOS
         TrainingDurationSelectiontitlelabel->SetPosition(83, 95, 300, 35);
         TrainingDurationSelectiontitlelabel->SetStyle(STYLE_TEXT_FONT, 30);
         TrainingDurationSelectiontitlelabel->SetStyle(STYLE_LINE_HEIGHT, 35);
-        TrainingDurationSelectiontitlelabel->SetText(presenter_->GetRespiratoryTrainingSelectTime().c_str());
+        TrainingDurationSelectiontitlelabel->SetTextId(presenter_->GetRespiratoryTrainingSelectTime());
         TrainingDurationSelectiontitlelabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
         TrainingDurationSelectiontitlelabel->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff));
         TrainingDurationSelectiontitlelabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);