修改蓝牙Slice以适配多国语言
authorluozheng <1732036298@qq.com>
Mon, 6 May 2024 07:09:31 +0000 (15:09 +0800)
committerluozheng <1732036298@qq.com>
Mon, 6 May 2024 07:09:31 +0000 (15:09 +0800)
16 files changed:
code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/BluetoothServiceOptionsView.h
code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/ClassicBlueToothView.h
code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/BluetoothServiceOptionsView.cpp
code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/ClassicBlueToothView.cpp
code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_en.txt
code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt
code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_en.xml
code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml
code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang
code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang
code/sdk/application/wearable/fd230app/nativeui/language/font/ui_resource_string.h
code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ja.lang
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang

index 3c997a1..eb20dde 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-25 11:49:58
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-25 15:14:34
+ * @LastEditTime: 2024-05-06 15:00:23
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/BluetoothServiceOptionsView.h
  */
 
@@ -32,7 +32,8 @@ namespace OHOS
             int16_t height;
             int16_t fontSize;      // 字体大小
             int16_t lineHeigh;     // 行高
-            const char *text;      // 文本
+            //const char *text;      // 文本
+            uint16_t textId;      
             uint8_t lineBreakMode; // 断行模式。
         };
         BluetoothServiceOptionsView();
index 9cad993..9264fc9 100644 (file)
@@ -1,3 +1,10 @@
+/*\r
+ * @Author: luozheng 1732036298@qq.com\r
+ * @Date: 2024-04-25 11:51:04\r
+ * @LastEditors: luozheng 1732036298@qq.com\r
+ * @LastEditTime: 2024-05-06 14:20:02\r
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/ClassicBlueToothView.h\r
+ */\r
 #ifndef CLASSIC_BLUETOOTH_VIEW_H\r
 #define CLASSIC_BLUETOOTH_VIEW_H\r
 \r
@@ -28,7 +35,8 @@ namespace OHOS
             int16_t height;\r
             int16_t fontSize;      // 字体大小\r
             int16_t lineHeigh;     // 行高\r
-            const char *text;      // 文本\r
+            //const char *text;    // 文本\r
+            uint16_t textId;      \r
             uint8_t lineBreakMode; // 断行模式。\r
         };\r
         ClassicBlueToothView();\r
index d800221..6f9beb8 100644 (file)
@@ -94,7 +94,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->SetText(labelconfig.text);                                                             // 内容
+        //label->SetText(labelconfig.text);                                                           // 内容
+        label->SetTextId(labelconfig.textId);                                                          
         label->SetLineBreakMode(labelconfig.lineBreakMode);                                           // 断行模式。
         label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelconfig.fontSize);
         return label;
@@ -110,7 +111,8 @@ namespace OHOS
             .height = 40,
             .fontSize = 30,
             .lineHeigh = 35,
-            .text = "蓝牙服务选项",
+            //.text = "蓝牙服务选项",
+            .textId = STR_BLUETOOTH_SERVICE_OPTIONS,
             .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,
         };
         Title = SetBluetoothServiceOptionsViewLabel(labelconfig);
@@ -128,7 +130,8 @@ namespace OHOS
             .height = 40,
             .fontSize = 30,
             .lineHeigh = 35,
-            .text = "通话蓝牙",
+            //.text = "通话蓝牙",
+            .textId = STR_HFP,
             .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,
         };
         HFP_Label = SetBluetoothServiceOptionsViewLabel(labelconfig);
@@ -138,7 +141,8 @@ namespace OHOS
             return false;
         }
         labelconfig.top = 273;
-        labelconfig.text = "媒体蓝牙";
+        //labelconfig.text = "媒体蓝牙";
+        labelconfig.textId = STR_A2DP;
         A2DP_Label = SetBluetoothServiceOptionsViewLabel(labelconfig);
         if (nullptr == A2DP_Label)
         {
index f4957a0..a6403bc 100644 (file)
@@ -95,7 +95,8 @@ namespace OHOS
         label->SetPosition(labelconfig.left, labelconfig.top, labelconfig.width, labelconfig.height); // 位置大小\r
         label->SetStyle(STYLE_TEXT_FONT, labelconfig.fontSize);                                       // 字体大小\r
         label->SetStyle(STYLE_LINE_HEIGHT, labelconfig.lineHeigh);                                    // 字体行高\r
-        label->SetText(labelconfig.text);                                                             // 内容\r
+        //label->SetText(labelconfig.text);                                                           // 内容\r
+        label->SetTextId(labelconfig.textId);                                                           \r
         label->SetLineBreakMode(labelconfig.lineBreakMode);                                           // 断行模式。\r
         label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelconfig.fontSize);\r
         return label;\r
@@ -111,7 +112,8 @@ namespace OHOS
             .height = 40,\r
             .fontSize = 30,\r
             .lineHeigh = 35,\r
-            .text = "蓝牙",\r
+            //.text = "蓝牙",\r
+            .textId = STR_BLUETOOTH,\r
             .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,\r
         };\r
         Title = SetClassicBlueToothViewLabel(labelconfig);\r
@@ -129,7 +131,8 @@ namespace OHOS
             .height = 40,\r
             .fontSize = 30,\r
             .lineHeigh = 35,\r
-            .text = "蓝牙耳机",\r
+            //.text = "蓝牙耳机",\r
+            .textId = STR_BLUETOOTH_HEADPHONES,\r
             .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,\r
         };\r
         BlueToothEarPhoneLabel = SetClassicBlueToothViewLabel(labelconfig);\r
@@ -140,7 +143,8 @@ namespace OHOS
         }\r
         /* -------------------------------------------------------------------------- */\r
         labelconfig.top = 273;\r
-        labelconfig.text = "传统蓝牙";\r
+        //labelconfig.text = "传统蓝牙";\r
+        labelconfig.textId = STR_TRADITIONAL_BLUETOOTH;\r
         TradionalBlueToothLabel = SetClassicBlueToothViewLabel(labelconfig);\r
         if (nullptr == TradionalBlueToothLabel)\r
         {\r
@@ -149,7 +153,8 @@ namespace OHOS
         }\r
         /* -------------------------------------------------------------------------- */\r
         labelconfig.top = 393;\r
-        labelconfig.text = "蓝牙服务选项";\r
+        //labelconfig.text = "蓝牙服务选项";\r
+        labelconfig.textId = STR_BLUETOOTH_SERVICE_OPTIONS;\r
         BluetoothServiceOptionsLabel = SetClassicBlueToothViewLabel(labelconfig);\r
         if (nullptr == BluetoothServiceOptionsLabel)\r
         {\r
@@ -164,7 +169,8 @@ namespace OHOS
             .height = 180,\r
             .fontSize = 20,\r
             .lineHeigh = 30,\r
-            .text = "注:开启后10分钟没连接成功会自动关闭,因为传统蓝牙长时间打开会增加电耗,建议在有需要的时候使用\n\n(该功能主要用于电话拨打/通知、音乐控制/传输等)",\r
+            //.text = "注:开启后10分钟没连接成功会自动关闭,因为传统蓝牙长时间打开会增加电耗,建议在有需要的时候使用\n\n(该功能主要用于电话拨打/通知、音乐控制/传输等)",\r
+            .textId = STR_AUTO_OFF_BLUETOOTH_NOTE,\r
             .lineBreakMode = UILabel::LINE_BREAK_WRAP,\r
         };\r
         AttentionLabel = SetClassicBlueToothViewLabel(labelconfig);\r
index 83559ee..b1b9505 100644 (file)
@@ -259,4 +259,10 @@ STR_VOLTE_CALL$VoLTE call
 STR_MOBILE_DATA_OPTION$Mobile data option\r
 STR_SYSTEM_UPDATE$System Update\r
 STR_ONLINE_MUSIC$Online music\r
+STR_BLUETOOTH_HEADPHONES$Bluetooth Headphones\r
+STR_TRADITIONAL_BLUETOOTH$Traditional Bluetooth\r
+STR_AUTO_OFF_BLUETOOTH_NOTE$Note: It will be automatically turned off if the connection is not successful for 10 minutes after opening, because the traditional Bluetooth will increase the power consumption for a long time, it is recommended to use when necessary\n\n(this function is mainly used for phone calls/notifications、music control/transmission, etc.)\r
+STR_BLUETOOTH_SERVICE_OPTIONS$Bluetooth Service Options\r
+STR_HFP$HFP\r
+STR_A2DP$A2DP\r
 STR_LANGUAGE$Language 
\ No newline at end of file
index 011a1ef..839acad 100644 (file)
@@ -259,4 +259,10 @@ STR_VOLTE_CALL$VoLTE 通话
 STR_MOBILE_DATA_OPTION$移动数据选项\r
 STR_SYSTEM_UPDATE$系统更新\r
 STR_ONLINE_MUSIC$在线音乐\r
+STR_BLUETOOTH_HEADPHONES$蓝牙耳机\r
+STR_TRADITIONAL_BLUETOOTH$传统蓝牙\r
+STR_AUTO_OFF_BLUETOOTH_NOTE$注:开启后10分钟没连接成功会自动关闭,因为传统蓝牙长时间打开会增加电耗,建议在有需要的时候使用\n\n(该功能主要用于电话拨打/通知、音乐控制/传输等)\r
+STR_BLUETOOTH_SERVICE_OPTIONS$蓝牙服务选项\r
+STR_HFP$通话蓝牙\r
+STR_A2DP$媒体蓝牙\r
 STR_LANGUAGE$语言
\ No newline at end of file
index 1188d92..02a50b4 100644 (file)
        <lanstr id="STR_MOBILE_DATA_OPTION" value="Mobile data option"/>
        <lanstr id="STR_SYSTEM_UPDATE" value="System Update"/>
        <lanstr id="STR_ONLINE_MUSIC" value="Online music"/>
+       <lanstr id="STR_BLUETOOTH_HEADPHONES" value="Bluetooth Headphones"/>
+       <lanstr id="STR_TRADITIONAL_BLUETOOTH" value="Traditional Bluetooth"/>
+       <lanstr id="STR_AUTO_OFF_BLUETOOTH_NOTE" value="Note: It will be automatically turned off if the connection is not successful for 10 minutes after opening, because the traditional Bluetooth will increase the power consumption for a long time, it is recommended to use when necessary\n\n(this function is mainly used for phone calls/notifications、music control/transmission, etc.)"/>
+       <lanstr id="STR_BLUETOOTH_SERVICE_OPTIONS" value="Bluetooth Service Options"/>
+       <lanstr id="STR_HFP" value="HFP"/>
+       <lanstr id="STR_A2DP" value="A2DP"/>
        <lanstr id="STR_LANGUAGE" value="Language"/>
 </language>
index 6e1440e..8a29365 100644 (file)
        <lanstr id="STR_MOBILE_DATA_OPTION" value="移动数据选项"/>
        <lanstr id="STR_SYSTEM_UPDATE" value="系统更新"/>
        <lanstr id="STR_ONLINE_MUSIC" value="在线音乐"/>
+       <lanstr id="STR_BLUETOOTH_HEADPHONES" value="蓝牙耳机"/>
+       <lanstr id="STR_TRADITIONAL_BLUETOOTH" value="传统蓝牙"/>
+       <lanstr id="STR_AUTO_OFF_BLUETOOTH_NOTE" value="注:开启后10分钟没连接成功会自动关闭,因为传统蓝牙长时间打开会增加电耗,建议在有需要的时候使用\n\n(该功能主要用于电话拨打/通知、音乐控制/传输等)"/>
+       <lanstr id="STR_BLUETOOTH_SERVICE_OPTIONS" value="蓝牙服务选项"/>
+       <lanstr id="STR_HFP" value="通话蓝牙"/>
+       <lanstr id="STR_A2DP" value="媒体蓝牙"/>
        <lanstr id="STR_LANGUAGE" value="语言"/>
 </language>
index f7dcfdc..283b2fa 100644 (file)
Binary files a/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang and b/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang differ
index d508778..fc7289d 100644 (file)
Binary files a/code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang and b/code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang differ
index ce9b236..8eac6e1 100644 (file)
@@ -274,8 +274,14 @@ enum UIResourceTextId : uint16_t {
     STR_MOBILE_DATA_OPTION = 261,\r
     STR_SYSTEM_UPDATE = 262,\r
     STR_ONLINE_MUSIC = 263,\r
-    STR_LANGUAGE = 264,\r
-    STR_MAX_ID = 265,\r
+    STR_BLUETOOTH_HEADPHONES = 264,\r
+    STR_TRADITIONAL_BLUETOOTH = 265,\r
+    STR_AUTO_OFF_BLUETOOTH_NOTE = 266,\r
+    STR_BLUETOOTH_SERVICE_OPTIONS = 267,\r
+    STR_HFP = 268,\r
+    STR_A2DP = 269,\r
+    STR_LANGUAGE = 270,\r
+    STR_MAX_ID = 271,\r
 }; // UIResourceTextId\r
 
 enum FontLanguageId : uint8_t {
index 7cae968..1c3af03 100644 (file)
Binary files a/code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang and b/code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang differ
index f7dcfdc..283b2fa 100644 (file)
Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang differ
index d508778..fc7289d 100644 (file)
Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ja.lang and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ja.lang differ
index ce9b236..8eac6e1 100644 (file)
@@ -274,8 +274,14 @@ enum UIResourceTextId : uint16_t {
     STR_MOBILE_DATA_OPTION = 261,\r
     STR_SYSTEM_UPDATE = 262,\r
     STR_ONLINE_MUSIC = 263,\r
-    STR_LANGUAGE = 264,\r
-    STR_MAX_ID = 265,\r
+    STR_BLUETOOTH_HEADPHONES = 264,\r
+    STR_TRADITIONAL_BLUETOOTH = 265,\r
+    STR_AUTO_OFF_BLUETOOTH_NOTE = 266,\r
+    STR_BLUETOOTH_SERVICE_OPTIONS = 267,\r
+    STR_HFP = 268,\r
+    STR_A2DP = 269,\r
+    STR_LANGUAGE = 270,\r
+    STR_MAX_ID = 271,\r
 }; // UIResourceTextId\r
 
 enum FontLanguageId : uint8_t {
index 7cae968..1c3af03 100644 (file)
Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang differ