From: xue <2144439972@qq.com> Date: Mon, 2 Feb 2026 07:00:26 +0000 (+0800) Subject: 生理周期英文适配 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=cb94968a2382e94d39066dbb1b4d8f7e68702a91;p=mirrors%2FFD230.git 生理周期英文适配 --- diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/womenhealth/src/WomenHealthMainPage.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/womenhealth/src/WomenHealthMainPage.cpp index 89d8cf92a..64397a35c 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/womenhealth/src/WomenHealthMainPage.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/womenhealth/src/WomenHealthMainPage.cpp @@ -240,7 +240,14 @@ namespace OHOS title_label->SetPosition(0, 20); // 顶部中央 title_label->Resize(454, 40); // 全屏宽度 - title_label->SetText("生理周期"); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + { + title_label->SetText("生理周期"); + } + else + { + title_label->SetText("Menstrual Cycle"); + } title_label->SetStyle(STYLE_TEXT_FONT, 28); title_label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); title_label->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); @@ -271,9 +278,17 @@ namespace OHOS // 格式化日期文本:"9月5日 星期五" static const char* weekday_str[] = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"}; + static const char* weekday_str_en[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"}; char date_text[50] = {0}; int wd = CalculateWeekday(year, month, day); // 计算星期几 - sprintf(date_text, "%d月%d日 %s", month, day, weekday_str[wd]); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + { + sprintf(date_text, "%d月%d日 %s", month, day, weekday_str[wd]); + } + else + { + sprintf(date_text, "%dth of %d Month %s", month, day, weekday_str_en[wd]); + } mon_label->SetText(date_text); mon_label->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); @@ -348,7 +363,14 @@ namespace OHOS edit_button->SetPosition(118, 350); // 底部中央 edit_button->Resize(230, 80); - edit_button->SetText("编辑"); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + { + edit_button->SetText("编辑"); + } + else + { + edit_button->SetText("Edit"); + } edit_button->SetStyle(STYLE_TEXT_FONT, 30); edit_button->SetStyle(STYLE_LINE_HEIGHT, 35); edit_button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); @@ -447,9 +469,23 @@ namespace OHOS // 判断当前显示的是否是今天所在月份 if (show_y == today_y && show_m == today_m) { - edit_button->SetText("编辑"); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + { + edit_button->SetText("编辑"); + } + else + { + edit_button->SetText("Edit"); + } } else { - edit_button->SetText("回今天"); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + { + edit_button->SetText("回今天"); + } + else + { + edit_button->SetText("Back to Today"); + } } } @@ -481,9 +517,17 @@ namespace OHOS // 第四步:更新日期标签 static const char* weekday_str[] = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"}; + static const char* weekday_str_en[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"}; char date_text[50] = {0}; int wd = CalculateWeekday(show_y, show_m, show_d); - sprintf(date_text, "%d月%d日 %s", show_m, show_d, weekday_str[wd]); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + { + sprintf(date_text, "%d月%d日 %s", show_m, show_d, weekday_str[wd]); + } + else + { + sprintf(date_text, "%dth of %d Month %s", show_m, show_d, weekday_str_en[wd]); + } mon_label->SetText(date_text); // 第五步:更新日期显示 @@ -780,9 +824,17 @@ namespace OHOS // 第六步:更新日期标签("X月X日 星期X"格式) static const char* weekday_str[] = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"}; + static const char* weekday_str_en[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"}; char date_text[50] = {0}; int wd = CalculateWeekday(show_y, show_m, show_d); // 使用当前保存的日期 - sprintf(date_text, "%d月%d日 %s", show_m, show_d, weekday_str[wd]); + if(ConfigModel::GetInstance()->GetLanguage() == 0) + { + sprintf(date_text, "%d月%d日 %s", show_m, show_d, weekday_str[wd]); + } + else + { + sprintf(date_text, "%dth of %d Month %s", show_m, show_d, weekday_str_en[wd]); + } mon_label->SetText(date_text); // 第七步:调用UpdateDayDisplay更新日期显示