diff --git a/entry/src/main/ets/common/constants/CommonConstants.ets b/entry/src/main/ets/common/constants/CommonConstants.ets index a74b1a11d3bd0eec0a262ee42c25e3f935b1829d..b46423c4e98f7e6371af05e05ef43a800cc2f93b 100644 --- a/entry/src/main/ets/common/constants/CommonConstants.ets +++ b/entry/src/main/ets/common/constants/CommonConstants.ets @@ -36,12 +36,12 @@ export default class CommonConstants { /** * Search text of Search component. */ - static readonly SEARCH_TEXT = '搜索'; + static readonly SEARCH_TEXT = $r('app.string.search'); /** * toast text of prompt component. */ - static readonly TOAST_TEXT_1 = '账目类型不能为空'; - static readonly TOAST_TEXT_2 = '账目金额不为正整数'; + static readonly TOAST_TEXT_1 = $r('app.string.TOAST_TEXT_1'); + static readonly TOAST_TEXT_2 = $r('app.string.TOAST_TEXT_2'); /** * Component size. */ diff --git a/entry/src/main/ets/pages/MainPage.ets b/entry/src/main/ets/pages/MainPage.ets index 427f777e19e7f1e8906e7f3ccf5858592c7f4f62..ab5ed84a6f690bf1a4c530f8fecf05d1a668dbda 100644 --- a/entry/src/main/ets/pages/MainPage.ets +++ b/entry/src/main/ets/pages/MainPage.ets @@ -17,7 +17,7 @@ import AccountTable from '../common/database/tables/AccountTable'; import AccountData from '../viewmodel/AccountData'; import CommonConstants from '../common/constants/CommonConstants'; import { DialogComponent } from '../view/DialogComponent'; -import { ImageList } from '../viewmodel/AccountList'; +import { ImageList, TextList } from '../viewmodel/AccountList'; import Logger from '../common/utils/Logger'; @Entry @@ -153,7 +153,7 @@ struct MainPage { .aspectRatio(CommonConstants.FULL_SIZE) .margin({ right: $r('app.float.edge_size_MP') }) - Text(item.typeText) + Text(TextList[item.typeText]) .height($r('app.float.component_size_SM')) .fontSize($r('app.float.font_size_M')) diff --git a/entry/src/main/ets/view/DialogComponent.ets b/entry/src/main/ets/view/DialogComponent.ets index d97102f617165e2ba90eca6cf6d9cd64daea41e7..2ed770756cbd77a2896b3d0c12fcf5aa4593029c 100644 --- a/entry/src/main/ets/view/DialogComponent.ets +++ b/entry/src/main/ets/view/DialogComponent.ets @@ -17,7 +17,7 @@ import { promptAction } from '@kit.ArkUI'; import AccountData from '../viewmodel/AccountData'; import AccountItem from '../viewmodel/AccountItem'; import CommonConstants from '../common/constants/CommonConstants'; -import { PayList, EarnList } from '../viewmodel/AccountList'; +import { PayList, EarnList, TextList } from '../viewmodel/AccountList'; @CustomDialog export struct DialogComponent { @@ -40,7 +40,7 @@ export struct DialogComponent { .fontSize($r('app.float.font_size_M')) .fontColor(this.curIndex === index ? $r('app.color.main_color') : Color.Gray) } - .width($r('app.float.component_size_MP')) + .width($r('app.float.component_size_LM')) .padding({ top: $r('app.float.edge_size_LM'), bottom: $r('app.float.edge_size_S') }) .margin({ bottom: $r('app.float.edge_size_S') }) .border({ @@ -80,7 +80,7 @@ export struct DialogComponent { .width($r('app.float.image_size')) .aspectRatio(CommonConstants.FULL_SIZE) - Text(item.typeText) + Text(TextList[item.typeText]) .fontSize($r('app.float.font_size_S')) .fontColor(this.curType === item.typeText ? Color.White : $r('app.color.main_color')) .margin({ top: $r('app.float.edge_size_S') }) diff --git a/entry/src/main/ets/viewmodel/AccountList.ets b/entry/src/main/ets/viewmodel/AccountList.ets index 16c694d0efe4e53dd88992954dbb7864d840cc49..130471ce283848c5855d3a0f8c28597b6ccf275d 100644 --- a/entry/src/main/ets/viewmodel/AccountList.ets +++ b/entry/src/main/ets/viewmodel/AccountList.ets @@ -20,37 +20,37 @@ export const PayList: Array = [ icon: $rawfile('foods.png'), iconSelected: $rawfile('foods_selected.png'), accountType: 0, - typeText: '吃饭' + typeText: 'foods' }, { icon: $rawfile('snacks.png'), iconSelected: $rawfile('snacks_selected.png'), accountType: 0, - typeText: '零食' + typeText: 'snacks' }, { icon: $rawfile('fuel.png'), iconSelected: $rawfile('fuel_selected.png'), accountType: 0, - typeText: '汽车加油' + typeText: 'fuel' }, { icon: $rawfile('travel.png'), iconSelected: $rawfile('travel_selected.png'), accountType: 0, - typeText: '旅游' + typeText: 'travel' }, { icon: $rawfile('games.png'), iconSelected: $rawfile('games_selected.png'), accountType: 0, - typeText: '娱乐' + typeText: 'games' }, { icon: $rawfile('pets.png'), iconSelected: $rawfile('pets_selected.png'), accountType: 0, - typeText: '宠物' + typeText: 'pets' } ] @@ -59,23 +59,34 @@ export const EarnList: Array = [ icon: $rawfile('income.png'), iconSelected: $rawfile('income_selected.png'), accountType: 1, - typeText: '工作收入' + typeText: 'income' }, { icon: $rawfile('invest.png'), iconSelected: $rawfile('invest_selected.png'), accountType: 1, - typeText: '投资' + typeText: 'invest' } ] export const ImageList: Record = { - '吃饭': $rawfile('foods.png'), - '零食': $rawfile('snacks.png'), - '汽车加油': $rawfile('fuel.png'), - '旅游': $rawfile('travel.png'), - '娱乐': $rawfile('games.png'), - '宠物': $rawfile('pets.png'), - '工作收入': $rawfile('income.png'), - '投资': $rawfile('invest.png') + 'foods': $rawfile('foods.png'), + 'snacks': $rawfile('snacks.png'), + 'fuel': $rawfile('fuel.png'), + 'travel': $rawfile('travel.png'), + 'games': $rawfile('games.png'), + 'pets': $rawfile('pets.png'), + 'income': $rawfile('income.png'), + 'invest': $rawfile('invest.png') +} + +export const TextList: Record = { + 'foods': $r('app.string.foods'), + 'snacks': $r('app.string.snacks'), + 'fuel': $r('app.string.fuel'), + 'travel': $r('app.string.travel'), + 'games': $r('app.string.games'), + 'pets': $r('app.string.pets'), + 'income': $r('app.string.income'), + 'invest': $r('app.string.invest') } \ No newline at end of file diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index 24f20887e8aa11605ba484c598f3f63f5adafecf..bf66fbd5498f44b3ddfbfb2b2a9ccac8a7bb2b63 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -20,7 +20,7 @@ "label": "$string:MainAbility_label", "startWindowIcon": "$media:icon", "startWindowBackground": "$color:white", - "exported": false, + "exported": true, "skills": [ { "entities": [ diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index 0e9596cca02dc80fe9546053c4a9e622a35c6adb..559460f060ce354e3f2a00c1ecce0d5eb63bc34a 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -10,31 +10,75 @@ }, { "name": "MainAbility_label", - "value": "关系型数据库" + "value": "Relational database" }, { "name": "edit_text", - "value": "编辑" + "value": "Edit" }, { "name": "pay_text", - "value": "支出" + "value": "Pay" }, { "name": "income_text", - "value": "收入" + "value": "Income" }, { "name": "count_text", - "value": "金额" + "value": "Amount" }, { "name": "input_text", - "value": "请输入金额" + "value": "Please enter the amount" }, { "name": "confirm_text", - "value": "确定" + "value": "Confirm" + }, + { + "name": "search", + "value": "Search" + }, + { + "name": "TOAST_TEXT_1", + "value": "The account item type cannot be empty" + }, + { + "name": "TOAST_TEXT_2", + "value": "The account item amount is not a positive integer" + }, + { + "name": "foods", + "value": "Foods" + }, + { + "name": "snacks", + "value": "Snacks" + }, + { + "name": "fuel", + "value": "Fuel" + }, + { + "name": "travel", + "value": "Travel" + }, + { + "name": "games", + "value": "Games" + }, + { + "name": "pets", + "value": "Pets" + }, + { + "name": "income", + "value": "Income" + }, + { + "name": "invest", + "value": "Invest" } ] } \ 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 new file mode 100644 index 0000000000000000000000000000000000000000..559460f060ce354e3f2a00c1ecce0d5eb63bc34a --- /dev/null +++ b/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,84 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "Relational database" + }, + { + "name": "edit_text", + "value": "Edit" + }, + { + "name": "pay_text", + "value": "Pay" + }, + { + "name": "income_text", + "value": "Income" + }, + { + "name": "count_text", + "value": "Amount" + }, + { + "name": "input_text", + "value": "Please enter the amount" + }, + { + "name": "confirm_text", + "value": "Confirm" + }, + { + "name": "search", + "value": "Search" + }, + { + "name": "TOAST_TEXT_1", + "value": "The account item type cannot be empty" + }, + { + "name": "TOAST_TEXT_2", + "value": "The account item amount is not a positive integer" + }, + { + "name": "foods", + "value": "Foods" + }, + { + "name": "snacks", + "value": "Snacks" + }, + { + "name": "fuel", + "value": "Fuel" + }, + { + "name": "travel", + "value": "Travel" + }, + { + "name": "games", + "value": "Games" + }, + { + "name": "pets", + "value": "Pets" + }, + { + "name": "income", + "value": "Income" + }, + { + "name": "invest", + "value": "Invest" + } + ] +} \ 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 new file mode 100644 index 0000000000000000000000000000000000000000..9ceb85eec2b10a9624ed18184f81d20d640ee386 --- /dev/null +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,84 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "关系型数据库" + }, + { + "name": "edit_text", + "value": "编辑" + }, + { + "name": "pay_text", + "value": "支出" + }, + { + "name": "income_text", + "value": "收入" + }, + { + "name": "count_text", + "value": "金额" + }, + { + "name": "input_text", + "value": "请输入金额" + }, + { + "name": "confirm_text", + "value": "确定" + }, + { + "name": "search", + "value": "搜索" + }, + { + "name": "TOAST_TEXT_1", + "value": "账目类型不能为空" + }, + { + "name": "TOAST_TEXT_2", + "value": "账目金额不为正整数" + }, + { + "name": "foods", + "value": "吃饭" + }, + { + "name": "snacks", + "value": "零食" + }, + { + "name": "fuel", + "value": "汽车加油" + }, + { + "name": "travel", + "value": "旅游" + }, + { + "name": "games", + "value": "娱乐" + }, + { + "name": "pets", + "value": "宠物" + }, + { + "name": "income", + "value": "工作收入" + }, + { + "name": "invest", + "value": "投资" + } + ] +} \ No newline at end of file