diff --git a/entry/src/main/ets/common/constants/CommonConstants.ets b/entry/src/main/ets/common/constants/CommonConstants.ets index 4f629e34e15e586dbb0af7b6e3c16498eb030297..77abb077c5744cd8fb6e890e972af50e3329a6fd 100644 --- a/entry/src/main/ets/common/constants/CommonConstants.ets +++ b/entry/src/main/ets/common/constants/CommonConstants.ets @@ -185,23 +185,6 @@ export class CommonConstants { */ static readonly ONE_ZERO: number = 1.0; - /** - * Privacy pop-up window content 1. - */ - static readonly TEXT_ONE: string = '根据《常见类型移动互联网应用程序必要个人信息范围规定》,主要功能为购买商品,必要个人信息为:' + - '注册用户电话号码;收货人姓名、地址、联系电话;支付时间、支付金额、支付渠道等。请您在使用我们的服务前仔细阅读'; - - /** - * Privacy pop-up window content 2. - */ - static readonly TEXT_TWO: string = '。请您知悉,同意隐私政策仅代表您已了解应用提供功能,以及功能运行所需的必要个人信息。基于您的授权我们可能会获取您的位置等信息,您有权拒绝或取消授权;' + - '我们会采取业界先进的安全措施保护您的信息安全;未经您同意,我们不会从第三方处获取、共享或向其提供您的信息;您可以查询、更正、删除您的个人信息'; - - /** - * Edit. - */ - static readonly EDIT: string = '编辑'; - /** * Saturday. */ diff --git a/entry/src/main/ets/pages/BindContentCoverDemo.ets b/entry/src/main/ets/pages/BindContentCoverDemo.ets index 6051c7a292d72468f3376d2d58c77077ac7bc401..d11ac00d5d166b6c1a797442d85b4e5e9f9a539a 100644 --- a/entry/src/main/ets/pages/BindContentCoverDemo.ets +++ b/entry/src/main/ets/pages/BindContentCoverDemo.ets @@ -71,7 +71,7 @@ struct BindContentCoverDemo { secondaryText: item.cardNum }), operateItem: ({ - text: CommonConstants.EDIT + text: $r('app.string.edit') }) }) } diff --git a/entry/src/main/ets/pages/BindSheet.ets b/entry/src/main/ets/pages/BindSheet.ets index 79793d7ccda1c0ad25e90df40e2d3d407c496cc0..3490712b0b331bb1894f4ce8a76333cc2ada7168 100644 --- a/entry/src/main/ets/pages/BindSheet.ets +++ b/entry/src/main/ets/pages/BindSheet.ets @@ -18,7 +18,7 @@ import { CommonConstants } from '../common/constants/CommonConstants'; @Component struct BindSheetDemo { @State isShowSheet: boolean = false; - private menuList: string[] = ['少放辣', '不需要辣', '需要一次性餐具', '多放辣', '不要香菜', '不要一次性餐具']; + private menuList: ResourceStr[] = [$r('app.string.spicy'), $r('app.string.spicy1'), $r('app.string.spicy2'), $r('app.string.spicy3'), $r('app.string.spicy4'), $r('app.string.spicy5')]; @Builder mySheet() { Column() { Flex({ direction: FlexDirection.Row, wrap: FlexWrap.Wrap }) { @@ -79,7 +79,7 @@ struct BindSheetDemo { .alignItems(VerticalAlign.Center) .padding({ left: $r('app.float.column_padding'), top: $r('app.float.column_padding'), bottom: $r('app.float.column_padding') }) .backgroundColor(Color.White) - .bindSheet(this.isShowSheet, this.mySheet(), { + .bindSheet($$this.isShowSheet, this.mySheet(), { height: $r('app.float.bind_sheet_height'), dragBar: false, showClose: false diff --git a/entry/src/main/ets/pages/CustomCalendar.ets b/entry/src/main/ets/pages/CustomCalendar.ets index 4e100ff933fd6ecbdd1e685f5e2366c73176dc35..a2da74a1877227aff55cc1b60743413fa7273669 100644 --- a/entry/src/main/ets/pages/CustomCalendar.ets +++ b/entry/src/main/ets/pages/CustomCalendar.ets @@ -21,7 +21,7 @@ import { CommonConstants } from '../common/constants/CommonConstants'; @Entry @Component export struct CalendarView { - private week: string[] = ['日', '一', '二', '三', '四', '五', '六']; + private week: ResourceStr[] = [$r('app.string.sunday'), $r('app.string.monday'), $r('app.string.tuesday'), $r('app.string.wednesday'), $r('app.string.thursday'), $r('app.string.friday'), $r('app.string.saturday')]; @State currentMonth: number = 1; @State currentDay: number = 1; @State currentYear: number = 1; @@ -48,6 +48,12 @@ export struct CalendarView { onCancel() { } + getResourceString(resource: Resource): string { + let resourceString: string = ''; + resourceString = getContext(this).resourceManager.getStringSync(resource.id); + return resourceString; + } + @Builder calendarMainView() { Column({ space: CommonConstants.ELEMENTS_MARGIN_L }) { @@ -64,9 +70,9 @@ export struct CalendarView { .width(CommonConstants.ONE_HUNDRED_PERCENT) Row({ space: CommonConstants.ELEMENTS_MARGIN_M }) { - Text(`${this.dateModel.month}月${this.dateModel.day}日`) + Text(`${this.dateModel.month}${this.getResourceString($r('app.string.month'))}${this.dateModel.day}${this.getResourceString($r('app.string.day'))}`) .fontSize($r('app.float.text_size_headline')) - Text(`星期${this.week[this.dateModel.week]}`) + Text(this.week[this.dateModel.week]) .fontSize($r('app.float.text_size_body1')) } .justifyContent(FlexAlign.Start) diff --git a/entry/src/main/ets/pages/Details.ets b/entry/src/main/ets/pages/Details.ets index 3c5e00b9ef27637d4f49eac847785fcc69227be1..c832289fdaa6986aec6819ad1cfe126534004820 100644 --- a/entry/src/main/ets/pages/Details.ets +++ b/entry/src/main/ets/pages/Details.ets @@ -22,7 +22,7 @@ struct Details { build() { Row() { Column() { - Button('返回').onClick(() => { + Button($r('app.string.back')).onClick(() => { router.back(); }) } diff --git a/entry/src/main/ets/pages/Privacy.ets b/entry/src/main/ets/pages/Privacy.ets index afbb9b83169c14d65e0f2703bc240288cc36ac13..6bbb972466528f69bad2fd9b3c5de19b7033bb4b 100644 --- a/entry/src/main/ets/pages/Privacy.ets +++ b/entry/src/main/ets/pages/Privacy.ets @@ -77,7 +77,7 @@ struct Privacy { Scroll(this.scroller) { Text() { - Span(CommonConstants.TEXT_ONE) + Span($r('app.string.word1')) Span($r('app.string.toast_text')) .fontColor(Color.Orange) .fontWeight(FontWeight.Bold) @@ -87,7 +87,7 @@ struct Privacy { url: 'pages/Details' }) }) - Span(CommonConstants.TEXT_TWO) + Span($r('app.string.word2')) } .fontSize($r('app.float.font_size1')) .padding({ diff --git a/entry/src/main/ets/pages/Toast.ets b/entry/src/main/ets/pages/Toast.ets index faf3c7d7451d62ac83e30c0ed34a2b16345ddc53..819f1e3f5447e2d1cc129aa3b6b30b5bfaa3b021 100644 --- a/entry/src/main/ets/pages/Toast.ets +++ b/entry/src/main/ets/pages/Toast.ets @@ -35,7 +35,7 @@ struct CustomDialogExample { @Component struct CustomDialogUser { @State textValue: string = ''; - @State inputValue: string = '点击Toast'; + @State inputValue: ResourceStr = $r('app.string.click'); dialogController: CustomDialogController | null = new CustomDialogController({ builder: CustomDialogExample(), openAnimation: { diff --git a/entry/src/main/ets/view/CustomCalendarPickerDialog.ets b/entry/src/main/ets/view/CustomCalendarPickerDialog.ets index c08c20c13c0c298d5bf620bfc70b05522349598d..a9623f053dbe4bad8ff08145c2480a4ed5fd3b97 100644 --- a/entry/src/main/ets/view/CustomCalendarPickerDialog.ets +++ b/entry/src/main/ets/view/CustomCalendarPickerDialog.ets @@ -32,7 +32,13 @@ export struct CustomCalendarPickerDialog { @StorageLink('selectedDate') dateModel: DateModel = new DateModel(0, 0, 0, 0); controller: CustomDialogController; cancel: () => void = () => {}; - private week: string[] = ['日', '一', '二', '三', '四', '五', '六']; + private week: ResourceStr[] = [$r('app.string.ri'), $r('app.string.yi'), $r('app.string.er'), $r('app.string.san'), $r('app.string.si'), $r('app.string.wu'), $r('app.string.liu')]; + + getResourceString(resource: Resource): string { + let resourceString: string = ''; + resourceString = getContext(this).resourceManager.getStringSync(resource.id); + return resourceString; + } aboutToAppear() { this.currentMonthDay = getMonthDate(this.currentMonth, this.currentYear); @@ -46,12 +52,12 @@ export struct CustomCalendarPickerDialog { this.nextMonthDay = getMonthDate(this.nextMonth, this.nextYear); let months: Month[] = [ { - month: `${this.currentYear}年 ${this.currentMonth}月`, + month: `${this.currentYear}${this.getResourceString($r('app.string.year'))} ${this.currentMonth}${this.getResourceString($r('app.string.month'))}`, num: this.currentMonth, days: this.currentMonthDay }, { - month: `${this.nextYear}年 ${this.nextMonth}月`, + month: `${this.nextYear}${this.getResourceString($r('app.string.year'))} ${this.nextMonth}${this.getResourceString($r('app.string.month'))}`, num: this.nextMonth, days: this.nextMonthDay } diff --git a/entry/src/main/ets/viewmodel/BindContentModel.ets b/entry/src/main/ets/viewmodel/BindContentModel.ets index 55eb2b787754cc8845df6ce0cd8a1eb9c203ce09..0a0b8727a57d6e2c2c61a1ba191261cf6c5e019d 100644 --- a/entry/src/main/ets/viewmodel/BindContentModel.ets +++ b/entry/src/main/ets/viewmodel/BindContentModel.ets @@ -13,13 +13,13 @@ * limitations under the License. */ export interface PersonList { - name: string, + name: ResourceStr, cardNum: string } export const personList: PersonList[] = [ - { name: '王**', cardNum: '1234***********789' }, - { name: '宋*', cardNum: '2345***********789' }, - { name: '许**', cardNum: '3456***********789' }, - { name: '唐*', cardNum: '4567***********789' } + { name: $r('app.string.wang'), cardNum: '1234***********789' }, + { name: $r('app.string.song'), cardNum: '2345***********789' }, + { name: $r('app.string.xu'), cardNum: '3456***********789' }, + { name: $r('app.string.tang'), cardNum: '4567***********789' } ]; \ No newline at end of file diff --git a/entry/src/main/resources/base/element/float.json b/entry/src/main/resources/base/element/float.json index 8aa1302f287c5f8f1c0d555d1eba13d9f10b413b..9705ce1e99cd4165ee286f4c3ab5c1709d4c5c99 100644 --- a/entry/src/main/resources/base/element/float.json +++ b/entry/src/main/resources/base/element/float.json @@ -134,7 +134,7 @@ }, { "name": "toast_width", - "value": "120vp" + "value": "150vp" }, { "name": "bottom_margin", diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index 8e6540bf5ab9285655dfcc47f5e5c8faff41c6f3..35a38aacd8c020f58c6eea8e5d11fff45362e84d 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -183,6 +183,130 @@ { "name": "button_five", "value": "close sheet1 sheet2" + }, + { + "name": "wang", + "value": "王**" + }, + { + "name": "song", + "value": "宋*" + }, + { + "name": "xu", + "value": "许**" + }, + { + "name": "tang", + "value": "唐*" + }, + { + "name": "spicy", + "value": "少放辣" + }, + { + "name": "spicy1", + "value": "不需要辣" + }, + { + "name": "spicy2", + "value": "需要一次性餐具" + }, + { + "name": "spicy3", + "value": "多放辣" + }, + { + "name": "spicy4", + "value": "不要香菜" + }, + { + "name": "spicy5", + "value": "不要一次性餐具" + }, + { + "name": "click", + "value": "点击Toast" + }, + { + "name": "back", + "value": "返回" + }, + { + "name": "word1", + "value": "根据《常见类型移动互联网应用程序必要个人信息范围规定》,主要功能为购买商品,必要个人信息为:注册用户电话号码;收货人姓名、地址、联系电话;支付时间、支付金额、支付渠道等。请您在使用我们的服务前仔细阅读" + }, + { + "name": "word2", + "value": "。请您知悉,同意隐私政策仅代表您已了解应用提供功能,以及功能运行所需的必要个人信息。基于您的授权我们可能会获取您的位置等信息,您有权拒绝或取消授权;我们会采取业界先进的安全措施保护您的信息安全;未经您同意,我们不会从第三方处获取、共享或向其提供您的信息;您可以查询、更正、删除您的个人信息" + }, + { + "name": "ri", + "value": "日" + }, + { + "name": "yi", + "value": "一" + }, + { + "name": "er", + "value": "二" + }, + { + "name": "san", + "value": "三" + }, + { + "name": "si", + "value": "四" + }, + { + "name": "wu", + "value": "五" + }, + { + "name": "liu", + "value": "六" + }, + { + "name": "year", + "value": "年" + }, + { + "name": "month", + "value": "月" + }, + { + "name": "day", + "value": "日" + }, + { + "name": "sunday", + "value": "星期日" + }, + { + "name": "monday", + "value": "星期一" + }, + { + "name": "tuesday", + "value": "星期二" + }, + { + "name": "wednesday", + "value": "星期三" + }, + { + "name": "thursday", + "value": "星期四" + }, + { + "name": "friday", + "value": "星期五" + }, + { + "name": "saturday", + "value": "星期六" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json index 1857d1cf40538e42b0dabda51fe50b13e2936f5b..af78288a7a9f6af5781c4e22da463dc879bdc4e1 100644 --- a/entry/src/main/resources/en_US/element/string.json +++ b/entry/src/main/resources/en_US/element/string.json @@ -10,7 +10,7 @@ }, { "name": "EntryAbility_label", - "value": "customized pop-up window set" + "value": "Customized pop-up window set" }, { "name": "departure", @@ -22,11 +22,11 @@ }, { "name": "check_ticket", - "value": "check ticket" + "value": "Check ticket" }, { "name": "departure_date", - "value": "departure date" + "value": "Departure date" }, { "name": "button_text", @@ -50,15 +50,15 @@ }, { "name": "index_name", - "value": "custom pop-up window collection" + "value": "Custom pop-up window collection" }, { "name": "scroll_option", - "value": "sliding selection popup" + "value": "Sliding selection popup" }, { "name": "select_person", - "value": "choose a rider" + "value": "Choose a rider" }, { "name": "add_person", @@ -66,15 +66,15 @@ }, { "name": "edit", - "value": "edit" + "value": "Edit" }, { "name": "confirmed", - "value": "confirm" + "value": "Confirm" }, { "name": "confirm_order", - "value": "confirm Order" + "value": "Confirm Order" }, { "name": "start_time", @@ -82,7 +82,7 @@ }, { "name": "start_string", - "value": "departure station" + "value": "Departure" }, { "name": "car_name", @@ -98,71 +98,195 @@ }, { "name": "end_name", - "value": "terminal" + "value": "Terminal" }, { "name": "button_select", - "value": "choose a rider" + "value": "Choose a rider" }, { "name": "dialog_name", - "value": "modal pop-up window" + "value": "Modal pop-up window" }, { "name": "tastes", - "value": "taste and tableware" + "value": "Taste and tableware" }, { "name": "choose_flavors", - "value": "choose your ordering flavors and tableware" + "value": "Choose flavors and cutlery" }, { "name": "bind_sheet_dialog", - "value": "semi-modal pop-up window" + "value": "Semi-modal pop-up window" }, { "name": "login", - "value": "login successfully !" + "value": "Login successfully !" }, { "name": "toast_dialog", - "value": "toast pop-up window" + "value": "Toast pop-up window" }, { "name": "button_name1", - "value": "privacy popup" + "value": "Privacy popup" }, { "name": "button_name2", - "value": "kind tips" + "value": "Kind tips" }, { "name": "two_level_dialog", - "value": "two-level semi-modal + full-screen pop-up window" + "value": "Two semi-modal + full-screen window" }, { "name": "toast_text", - "value": "privacy Policy" + "value": "Privacy Policy" }, { "name": "disagree", - "value": "disagree" + "value": "Disagree" }, { "name": "agreed", - "value": "agree" + "value": "Agree" }, { "name": "toast_private_dialog", - "value": "privacy Agreement pop-up window" + "value": "Privacy Agreement pop-up window" }, { "name": "full_screen", - "value": "full screen pop-up window" + "value": "Full screen pop-up window" }, { "name": "calendar_dialog", - "value": "custom calendar picker popup" + "value": "Custom calendar picker popup" + }, + { + "name": "wang", + "value": "wang**" + }, + { + "name": "song", + "value": "song*" + }, + { + "name": "xu", + "value": "xu**" + }, + { + "name": "tang", + "value": "tang*" + }, + { + "name": "spicy", + "value": "Less spicy" + }, + { + "name": "spicy1", + "value": "No need for spicy" + }, + { + "name": "spicy2", + "value": "Need disposable cutlery" + }, + { + "name": "spicy3", + "value": "Extra spicy" + }, + { + "name": "spicy4", + "value": "No cilantro" + }, + { + "name": "spicy5", + "value": "No disposable utensils" + }, + { + "name": "click", + "value": "Click Toast" + }, + { + "name": "back", + "value": "Back" + }, + { + "name": "word1", + "value": "According to the Provisions on the Scope of Necessary Personal Information for Common Types of Mobile Internet Applications, the main function is to purchase goods, and the necessary personal information is: telephone number of registered users; Name, address and telephone number of the consignee; Payment time, payment amount, payment channel, etc. Please read carefully before using our services" + }, + { + "name": "word2", + "value": ". Please note that agreeing to the Privacy policy only means that you have understood the functions provided by the App and the necessary personal information required for the function to operate. Based on your authorization, we may obtain your location and other information, and you have the right to refuse or cancel the authorization; We will take the industry's advanced security measures to protect your information security; We will not obtain, share or provide your information from third parties without your consent; You can query, correct and delete your personal information" + }, + { + "name": "ri", + "value": "Sun" + }, + { + "name": "yi", + "value": "Mon" + }, + { + "name": "er", + "value": "Tue" + }, + { + "name": "san", + "value": "Wed" + }, + { + "name": "si", + "value": "Thu" + }, + { + "name": "wu", + "value": "Fri" + }, + { + "name": "liu", + "value": "Sat" + }, + { + "name": "year", + "value": "year" + }, + { + "name": "month", + "value": "month" + }, + { + "name": "day", + "value": "day" + }, + { + "name": "sunday", + "value": "Sunday" + }, + { + "name": "monday", + "value": "Monday" + }, + { + "name": "tuesday", + "value": "Tuesday" + }, + { + "name": "wednesday", + "value": "Wednesday" + }, + { + "name": "thursday", + "value": "Thursday" + }, + { + "name": "friday", + "value": "Friday" + }, + { + "name": "saturday", + "value": "Saturday" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/zh_CN/element/string.json b/entry/src/main/resources/zh_CN/element/string.json index 76387159c363b59ea1e62bbe82999e56a1184899..db7ba4b2eb2c6c5ccef55630b8bbcb0e407e726a 100644 --- a/entry/src/main/resources/zh_CN/element/string.json +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -163,6 +163,130 @@ { "name": "calendar_dialog", "value": "自定义日历选择器弹窗" + }, + { + "name": "wang", + "value": "王**" + }, + { + "name": "song", + "value": "宋*" + }, + { + "name": "xu", + "value": "许**" + }, + { + "name": "tang", + "value": "唐*" + }, + { + "name": "spicy", + "value": "少放辣" + }, + { + "name": "spicy1", + "value": "不需要辣" + }, + { + "name": "spicy2", + "value": "需要一次性餐具" + }, + { + "name": "spicy3", + "value": "多放辣" + }, + { + "name": "spicy4", + "value": "不要香菜" + }, + { + "name": "spicy5", + "value": "不要一次性餐具" + }, + { + "name": "click", + "value": "点击Toast" + }, + { + "name": "back", + "value": "返回" + }, + { + "name": "word1", + "value": "根据《常见类型移动互联网应用程序必要个人信息范围规定》,主要功能为购买商品,必要个人信息为:注册用户电话号码;收货人姓名、地址、联系电话;支付时间、支付金额、支付渠道等。请您在使用我们的服务前仔细阅读" + }, + { + "name": "word2", + "value": "。请您知悉,同意隐私政策仅代表您已了解应用提供功能,以及功能运行所需的必要个人信息。基于您的授权我们可能会获取您的位置等信息,您有权拒绝或取消授权;我们会采取业界先进的安全措施保护您的信息安全;未经您同意,我们不会从第三方处获取、共享或向其提供您的信息;您可以查询、更正、删除您的个人信息" + }, + { + "name": "ri", + "value": "日" + }, + { + "name": "yi", + "value": "一" + }, + { + "name": "er", + "value": "二" + }, + { + "name": "san", + "value": "三" + }, + { + "name": "si", + "value": "四" + }, + { + "name": "wu", + "value": "五" + }, + { + "name": "liu", + "value": "六" + }, + { + "name": "year", + "value": "年" + }, + { + "name": "month", + "value": "月" + }, + { + "name": "day", + "value": "日" + }, + { + "name": "sunday", + "value": "星期日" + }, + { + "name": "monday", + "value": "星期一" + }, + { + "name": "tuesday", + "value": "星期二" + }, + { + "name": "wednesday", + "value": "星期三" + }, + { + "name": "thursday", + "value": "星期四" + }, + { + "name": "friday", + "value": "星期五" + }, + { + "name": "saturday", + "value": "星期六" } ] } \ No newline at end of file