From 5746341c0de5daca7889427ee3dfe9fd23c1af5f Mon Sep 17 00:00:00 2001 From: code-a1 <68858676+code-a1@users.noreply.github.com> Date: Wed, 20 Apr 2022 18:08:08 +0200 Subject: [PATCH 1/4] Added strings in strings.xml --- .../wallet/ui/edit/EditTransactionScreen.kt | 20 ++++++++-------- .../wallet/ui/edit/PrimaryAttributeColumn.kt | 3 ++- .../ivy/wallet/ui/edit/TransactionDateTime.kt | 3 ++- .../com/ivy/wallet/ui/edit/core/Category.kt | 3 ++- .../ivy/wallet/ui/edit/core/Description.kt | 5 ++-- .../com/ivy/wallet/ui/edit/core/DueDate.kt | 3 ++- .../wallet/ui/edit/core/EditBottomSheet.kt | 13 ++++++----- .../java/com/ivy/wallet/ui/edit/core/Title.kt | 8 ++++--- .../com/ivy/wallet/ui/edit/core/Toolbar.kt | 5 ++-- app/src/main/res/values/strings.xml | 23 +++++++++++++++++++ 10 files changed, 59 insertions(+), 27 deletions(-) diff --git a/app/src/main/java/com/ivy/wallet/ui/edit/EditTransactionScreen.kt b/app/src/main/java/com/ivy/wallet/ui/edit/EditTransactionScreen.kt index 3a9e655b5f..564b96fd5f 100644 --- a/app/src/main/java/com/ivy/wallet/ui/edit/EditTransactionScreen.kt +++ b/app/src/main/java/com/ivy/wallet/ui/edit/EditTransactionScreen.kt @@ -11,6 +11,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.layout.onGloballyPositioned import androidx.compose.ui.layout.positionInParent +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.tooling.preview.Preview @@ -335,7 +336,7 @@ private fun BoxWithConstraintsScope.UI( val nav = navigation() AddPrimaryAttributeButton( icon = R.drawable.ic_planned_payments, - text = "Add planned date of payment", + text = stringResource(R.string.add_planned_date_payment), onClick = { nav.back() nav.navigateTo( @@ -386,7 +387,7 @@ private fun BoxWithConstraintsScope.UI( } } else { //no changes, pay - ModalCheck(label = if (transactionType == TransactionType.EXPENSE) "Pay" else "Get") { + ModalCheck(label = if (transactionType == TransactionType.EXPENSE) stringResource(R.string.pay) else stringResource(R.string.get)) { onPayPlannedPayment() } } @@ -485,8 +486,8 @@ private fun BoxWithConstraintsScope.UI( DeleteModal( visible = deleteTrnModalVisible, - title = "Confirm deletion", - description = "Deleting this transaction will remove it from the transaction history and update the balance accordingly.", + title = stringResource(R.string.confirm_deletion), + description = stringResource(R.string.confirm_deletion_description), dismiss = { deleteTrnModalVisible = false } ) { onDelete() @@ -505,10 +506,9 @@ private fun BoxWithConstraintsScope.UI( DeleteModal( visible = accountChangeModal, - title = "Confirm Account Change", - description = "Note: You are trying to change the account associated with the loan with an account of different currency, " + - "\nAll the loan records will be re-calculated based on today's exchanges rates ", - buttonText = "Confirm", + title = stringResource(R.string.confirm_account_change), + description = stringResource(R.string.confirm_account_change_description), + buttonText = stringResource(R.string.confirm), iconStart = R.drawable.ic_agreed, dismiss = { accountChangeModal = false @@ -519,8 +519,8 @@ private fun BoxWithConstraintsScope.UI( } ProgressModal( - title = "Confirm Account Change", - description = "Please wait, re-calculating all loan records", + title = stringResource(R.string.confirm_account_change), + description = stringResource(R.string.account_change_recalculating), visible = waitModalVisible ) diff --git a/app/src/main/java/com/ivy/wallet/ui/edit/PrimaryAttributeColumn.kt b/app/src/main/java/com/ivy/wallet/ui/edit/PrimaryAttributeColumn.kt index 476c201c43..a6d36fc481 100644 --- a/app/src/main/java/com/ivy/wallet/ui/edit/PrimaryAttributeColumn.kt +++ b/app/src/main/java/com/ivy/wallet/ui/edit/PrimaryAttributeColumn.kt @@ -9,6 +9,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -66,7 +67,7 @@ private fun PreviewPrimaryAttributeColumn() { IvyWalletComponentPreview { PrimaryAttributeColumn( icon = R.drawable.ic_description, - title = "Description", + title = stringResource(R.string.description_text), onClick = { } ) { Spacer(Modifier.height(12.dp)) diff --git a/app/src/main/java/com/ivy/wallet/ui/edit/TransactionDateTime.kt b/app/src/main/java/com/ivy/wallet/ui/edit/TransactionDateTime.kt index a10a7379b3..dd7ac93b27 100644 --- a/app/src/main/java/com/ivy/wallet/ui/edit/TransactionDateTime.kt +++ b/app/src/main/java/com/ivy/wallet/ui/edit/TransactionDateTime.kt @@ -9,6 +9,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -50,7 +51,7 @@ fun TransactionDateTime( Spacer(Modifier.width(8.dp)) Text( - text = "Created on", + text = stringResource(R.string.created_on), style = UI.typo.b2.style( color = UI.colors.gray, fontWeight = FontWeight.Bold diff --git a/app/src/main/java/com/ivy/wallet/ui/edit/core/Category.kt b/app/src/main/java/com/ivy/wallet/ui/edit/core/Category.kt index 1b5817ee56..b43e101c52 100644 --- a/app/src/main/java/com/ivy/wallet/ui/edit/core/Category.kt +++ b/app/src/main/java/com/ivy/wallet/ui/edit/core/Category.kt @@ -3,6 +3,7 @@ package com.ivy.wallet.ui.edit.core import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import com.ivy.design.l0_system.UI @@ -31,7 +32,7 @@ fun Category( modifier = Modifier.padding(start = 24.dp), iconStart = R.drawable.ic_plus, iconTint = UI.colors.pureInverse, - text = "Add category" + text = stringResource(R.string.add_category) ) { onChooseCategory() } diff --git a/app/src/main/java/com/ivy/wallet/ui/edit/core/Description.kt b/app/src/main/java/com/ivy/wallet/ui/edit/core/Description.kt index fd676f1fa4..3e1efa762f 100644 --- a/app/src/main/java/com/ivy/wallet/ui/edit/core/Description.kt +++ b/app/src/main/java/com/ivy/wallet/ui/edit/core/Description.kt @@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -33,7 +34,7 @@ fun Description( } else { AddPrimaryAttributeButton( icon = R.drawable.ic_description, - text = "Add description", + text = stringResource(R.string.add_description), onClick = onAddDescription ) } @@ -46,7 +47,7 @@ private fun DescriptionText( ) { PrimaryAttributeColumn( icon = R.drawable.ic_description, - title = "Description", + title = stringResource(R.string.description_text), onClick = onClick ) { Spacer(Modifier.height(12.dp)) diff --git a/app/src/main/java/com/ivy/wallet/ui/edit/core/DueDate.kt b/app/src/main/java/com/ivy/wallet/ui/edit/core/DueDate.kt index a9b3c0ecab..340ef8db74 100644 --- a/app/src/main/java/com/ivy/wallet/ui/edit/core/DueDate.kt +++ b/app/src/main/java/com/ivy/wallet/ui/edit/core/DueDate.kt @@ -9,6 +9,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -56,7 +57,7 @@ private fun DueDateCard( Spacer(Modifier.width(8.dp)) Text( - text = "Planned for", + text = stringResource(R.string.planned_for), style = UI.typo.b2.style( fontWeight = FontWeight.ExtraBold, color = UI.colors.pureInverse diff --git a/app/src/main/java/com/ivy/wallet/ui/edit/core/EditBottomSheet.kt b/app/src/main/java/com/ivy/wallet/ui/edit/core/EditBottomSheet.kt index aecf19e906..7feaf65cc7 100644 --- a/app/src/main/java/com/ivy/wallet/ui/edit/core/EditBottomSheet.kt +++ b/app/src/main/java/com/ivy/wallet/ui/edit/core/EditBottomSheet.kt @@ -22,6 +22,7 @@ import androidx.compose.ui.layout.layout import androidx.compose.ui.layout.onSizeChanged import androidx.compose.ui.platform.LocalView import androidx.compose.ui.platform.testTag +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp @@ -135,9 +136,9 @@ fun BoxWithConstraintsScope.EditBottomSheet( ) { //Accounts label val label = when (type) { - TransactionType.INCOME -> "Add money to" - TransactionType.EXPENSE -> "Pay with" - TransactionType.TRANSFER -> "From" + TransactionType.INCOME -> stringResource(R.string.add_money_to) + TransactionType.EXPENSE -> stringResource(R.string.pay_with) + TransactionType.TRANSFER -> stringResource(R.string.from) } SheetHeader( @@ -223,7 +224,7 @@ fun BoxWithConstraintsScope.EditBottomSheet( Text( modifier = Modifier.padding(start = 32.dp), - text = "Account", + text = stringResource(R.string.account), style = UI.typo.b1.style( color = UI.colors.pureInverse, fontWeight = FontWeight.ExtraBold @@ -439,7 +440,7 @@ private fun SheetHeader( Text( modifier = Modifier.padding(start = 32.dp), - text = "To", + text = stringResource(R.string.to), style = UI.typo.b1.style( color = UI.colors.pureInverse, fontWeight = FontWeight.ExtraBold @@ -588,7 +589,7 @@ private fun AddAccount( Text( modifier = Modifier.padding(vertical = 10.dp), - text = "Add account", + text = stringResource(R.string.add_account), style = UI.typo.b2.style( color = UI.colors.pureInverse, fontWeight = FontWeight.ExtraBold diff --git a/app/src/main/java/com/ivy/wallet/ui/edit/core/Title.kt b/app/src/main/java/com/ivy/wallet/ui/edit/core/Title.kt index d590db58ad..a2d17635fe 100644 --- a/app/src/main/java/com/ivy/wallet/ui/edit/core/Title.kt +++ b/app/src/main/java/com/ivy/wallet/ui/edit/core/Title.kt @@ -15,6 +15,7 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardCapitalization @@ -24,6 +25,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.ivy.design.l0_system.UI import com.ivy.design.l0_system.style +import com.ivy.wallet.R import com.ivy.wallet.domain.data.TransactionType import com.ivy.wallet.ui.IvyWalletComponentPreview import com.ivy.wallet.ui.theme.components.IvyTitleTextField @@ -56,9 +58,9 @@ fun ColumnScope.Title( .padding(horizontal = 24.dp), value = titleTextFieldValue, hint = when (type) { - TransactionType.INCOME -> "Income title" - TransactionType.EXPENSE -> "Expense title" - TransactionType.TRANSFER -> "Transfer title" + TransactionType.INCOME -> stringResource(R.string.income_title) + TransactionType.EXPENSE -> stringResource(R.string.expense_title) + TransactionType.TRANSFER -> stringResource(R.string.transfer_title) }, keyboardOptions = KeyboardOptions( autoCorrect = true, diff --git a/app/src/main/java/com/ivy/wallet/ui/edit/core/Toolbar.kt b/app/src/main/java/com/ivy/wallet/ui/edit/core/Toolbar.kt index 611cff02ac..9f7e69824e 100644 --- a/app/src/main/java/com/ivy/wallet/ui/edit/core/Toolbar.kt +++ b/app/src/main/java/com/ivy/wallet/ui/edit/core/Toolbar.kt @@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.width import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.ivy.design.api.navigation import com.ivy.wallet.R @@ -38,7 +39,7 @@ fun Toolbar( when (type) { TransactionType.INCOME -> { IvyOutlinedButton( - text = "Income", + text = stringResource(R.string.income), iconStart = R.drawable.ic_income ) { onChangeTransactionTypeModal() @@ -48,7 +49,7 @@ fun Toolbar( } TransactionType.EXPENSE -> { IvyOutlinedButton( - text = "Expense", + text = stringResource(R.string.expense), iconStart = R.drawable.ic_expense ) { onChangeTransactionTypeModal() diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6d40278ff9..23c54342aa 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -68,4 +68,27 @@ Failed %1$d rows from CSV file not recognized Finish + Add description + Description + Planned for + Add money to + Pay with + From + Account + To + Add account + Income title + Expense title + Transfer title + Expense + Add planned date of payment + Pay + Get + Confirm deletion + Deleting this transaction will remove it from the transaction history and update the balance accordingly. + Confirm Account Change + Note: You are trying to change the account associated with the loan with an account of different currency, \nAll the loan records will be re-calculated based on today\'s exchanges rates + Confirm + Please wait, re-calculating all loan records + Created on From d278d07b5ef0d3541578f2ef51d393c3e782662e Mon Sep 17 00:00:00 2001 From: code-a1 <68858676+code-a1@users.noreply.github.com> Date: Wed, 20 Apr 2022 19:23:24 +0200 Subject: [PATCH 2/4] Added strings in strings.xml --- .../java/com/ivy/wallet/ui/home/HomeHeader.kt | 9 +++--- .../com/ivy/wallet/ui/home/HomeMoreMenu.kt | 29 ++++++++++--------- .../java/com/ivy/wallet/ui/home/HomeTab.kt | 11 +++---- app/src/main/res/values/strings.xml | 18 ++++++++++++ 4 files changed, 44 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/com/ivy/wallet/ui/home/HomeHeader.kt b/app/src/main/java/com/ivy/wallet/ui/home/HomeHeader.kt index fe4b31cfd1..baf16d0f45 100644 --- a/app/src/main/java/com/ivy/wallet/ui/home/HomeHeader.kt +++ b/app/src/main/java/com/ivy/wallet/ui/home/HomeHeader.kt @@ -16,6 +16,7 @@ import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.testTag +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import com.ivy.design.api.navigation @@ -120,7 +121,7 @@ private fun HeaderStickyRow( modifier = Modifier .alpha(percentExpanded) .testTag("home_greeting_text"), - text = if (name.isNotNullOrBlank()) "Hi $name" else "Hi", + text = if (name.isNotNullOrBlank()) stringResource(R.string.hi_name, name) else stringResource(R.string.hi), style = UI.typo.b1.style( fontWeight = FontWeight.ExtraBold, color = UI.colors.pureInverse @@ -234,7 +235,7 @@ fun CashFlowInfo( modifier = Modifier.padding( start = 24.dp ), - text = "Cashflow: ${if (cashflow > 0) "+" else ""}${cashflow.format(currency)} $currency", + text = stringResource(R.string.cashflow, (if (cashflow > 0) "+" else ""), cashflow.format(currency), currency), style = UI.typo.nB2.style( color = if (cashflow < 0) Gray else Green ) @@ -268,7 +269,7 @@ private fun IncomeExpenses( icon = R.drawable.ic_income, backgroundGradient = GradientGreen, textColor = White, - label = "Income", + label = stringResource(R.string.income), currency = currency, amount = monthlyIncome ) { @@ -286,7 +287,7 @@ private fun IncomeExpenses( icon = R.drawable.ic_expense, backgroundGradient = Gradient(UI.colors.pureInverse, UI.colors.gray), textColor = UI.colors.pure, - label = "Expenses", + label = stringResource(R.string.expenses), currency = currency, amount = monthlyExpenses.absoluteValue ) { diff --git a/app/src/main/java/com/ivy/wallet/ui/home/HomeMoreMenu.kt b/app/src/main/java/com/ivy/wallet/ui/home/HomeMoreMenu.kt index a84948bd97..a7427ab022 100644 --- a/app/src/main/java/com/ivy/wallet/ui/home/HomeMoreMenu.kt +++ b/app/src/main/java/com/ivy/wallet/ui/home/HomeMoreMenu.kt @@ -18,6 +18,7 @@ import androidx.compose.ui.layout.layout import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalUriHandler import androidx.compose.ui.platform.testTag +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview @@ -250,7 +251,7 @@ private fun SearchButton( modifier = Modifier.padding( vertical = 12.dp, ), - text = "Search transactions", + text = stringResource(R.string.search_transactions), style = UI.typo.b2.style( fontWeight = FontWeight.SemiBold, color = UI.colors.pureInverse @@ -291,7 +292,7 @@ private fun ColumnScope.OpenSource() { .padding(start = 16.dp, end = 24.dp) ) { Text( - text = "Ivy Wallet is open-source", + text = stringResource(R.string.ivy_wallet_open_source), style = UI.typo.b2.style( fontWeight = FontWeight.ExtraBold ) @@ -330,7 +331,7 @@ private fun ColumnScope.Buffer( Spacer(Modifier.width(24.dp)) Text( - text = "Savings goal", + text = stringResource(R.string.savings_goal), style = UI.typo.b1.style( color = UI.colors.pureInverse, fontWeight = FontWeight.ExtraBold @@ -369,7 +370,7 @@ private fun QuickAccess( Text( modifier = Modifier.padding(start = 24.dp), - text = "Quick access" + text = stringResource(R.string.quick_access) ) Spacer(Modifier.height(16.dp)) @@ -383,7 +384,7 @@ private fun QuickAccess( MoreMenuButton( icon = R.drawable.home_more_menu_settings, - label = "Settings" + label = stringResource(R.string.settings) ) { nav.navigateTo(Settings) } @@ -392,7 +393,7 @@ private fun QuickAccess( MoreMenuButton( icon = R.drawable.home_more_menu_categories, - label = "Categories" + label = stringResource(R.string.categories) ) { nav.navigateTo(Categories) } @@ -406,9 +407,9 @@ private fun QuickAccess( Theme.AUTO -> R.drawable.home_more_menu_auto_mode }, label = when (theme) { - Theme.LIGHT -> "Light mode" - Theme.DARK -> "Dark mode" - Theme.AUTO -> "Auto mode" + Theme.LIGHT -> stringResource(R.string.light_mode) + Theme.DARK -> stringResource(R.string.dark_mode) + Theme.AUTO -> stringResource(R.string.auto_mode) }, backgroundColor = when (theme) { Theme.LIGHT -> UI.colors.pure @@ -428,7 +429,7 @@ private fun QuickAccess( MoreMenuButton( icon = R.drawable.home_more_menu_planned_payments, - label = "Planned\nPayments" + label = stringResource(R.string.planned_payments) ) { nav.navigateTo(PlannedPayments) } @@ -456,7 +457,7 @@ private fun QuickAccess( MoreMenuButton( icon = R.drawable.home_more_menu_share, - label = "Share Ivy" + label = stringResource(R.string.share_ivy) ) { (context as RootActivity).shareIvyWallet() } @@ -465,7 +466,7 @@ private fun QuickAccess( MoreMenuButton( icon = R.drawable.home_more_menu_reports, - label = "Reports", + label = stringResource(R.string.reports), ) { nav.navigateTo(Report) } @@ -474,7 +475,7 @@ private fun QuickAccess( MoreMenuButton( icon = R.drawable.home_more_menu_budgets, - label = "Budgets", + label = stringResource(R.string.budgets), ) { nav.navigateTo(BudgetScreen) } @@ -483,7 +484,7 @@ private fun QuickAccess( MoreMenuButton( icon = R.drawable.home_more_menu_loans, - label = "Loans", + label = stringResource(R.string.loans), ) { nav.navigateTo(Loans) } diff --git a/app/src/main/java/com/ivy/wallet/ui/home/HomeTab.kt b/app/src/main/java/com/ivy/wallet/ui/home/HomeTab.kt index 2ec26733aa..50d427b3b5 100644 --- a/app/src/main/java/com/ivy/wallet/ui/home/HomeTab.kt +++ b/app/src/main/java/com/ivy/wallet/ui/home/HomeTab.kt @@ -12,6 +12,7 @@ import androidx.compose.ui.geometry.Offset import androidx.compose.ui.input.nestedscroll.NestedScrollConnection import androidx.compose.ui.input.nestedscroll.NestedScrollSource import androidx.compose.ui.input.nestedscroll.nestedScroll +import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Velocity import androidx.compose.ui.unit.dp @@ -20,12 +21,14 @@ import com.google.accompanist.insets.systemBarsPadding import com.ivy.design.api.navigation import com.ivy.design.l0_system.Theme import com.ivy.wallet.Constants +import com.ivy.wallet.R import com.ivy.wallet.domain.data.IvyCurrency import com.ivy.wallet.domain.data.TransactionHistoryItem import com.ivy.wallet.domain.data.entity.Account import com.ivy.wallet.domain.data.entity.Category import com.ivy.wallet.domain.data.entity.Transaction import com.ivy.wallet.domain.logic.model.CustomerJourneyCardData +import com.ivy.wallet.stringRes import com.ivy.wallet.ui.IvyWalletPreview import com.ivy.wallet.ui.Main import com.ivy.wallet.ui.ivyWalletCtx @@ -287,7 +290,7 @@ private fun BoxWithConstraintsScope.UI( } CurrencyModal( - title = "Set currency", + title = stringResource(R.string.set_currency), initialCurrency = IvyCurrency.fromCode(currencyCode), visible = currencyModalVisible, dismiss = { currencyModalVisible = false } @@ -441,10 +444,8 @@ fun HomeLazyColumn( overdueExpenses = overdueExpenses, history = history, onPayOrGet = onPayOrGet, - emptyStateTitle = "No transactions", - emptyStateText = "You don't have any transactions for ${ - period.toDisplayLong(ivyContext.startDayOfMonth) - }.\nYou can add one by tapping the \"+\" button." + emptyStateTitle = stringRes(R.string.no_transactions), + emptyStateText = stringRes(R.string.no_transactions_description, period.toDisplayLong(ivyContext.startDayOfMonth)) ) } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 23c54342aa..8df4da89e4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -91,4 +91,22 @@ Confirm Please wait, re-calculating all loan records Created on + Hi + Hi %1$s + Cashflow: %1$s%2$s %3$s + Search transactions + Ivy Wallet is open-source + Savings goal + Quick access + Settings + Light mode + Dark mode + Auto mode + Planned\nPayments + Share Ivy + Reports + Loans + Set currency + No transactions + You don\'t have any transactions for %1$s.\nYou can add one by tapping the \"+\" button. From a8163f473bca61bbd601e0e2d5e58a5ccedce7ae Mon Sep 17 00:00:00 2001 From: code-a1 <68858676+code-a1@users.noreply.github.com> Date: Wed, 20 Apr 2022 19:27:58 +0200 Subject: [PATCH 3/4] Added strings in strings.xml --- app/src/main/java/com/ivy/wallet/ui/loan/LoanBottomBar.kt | 3 ++- app/src/main/java/com/ivy/wallet/ui/loan/LoansScreen.kt | 8 ++++---- app/src/main/res/values/strings.xml | 3 +++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/ivy/wallet/ui/loan/LoanBottomBar.kt b/app/src/main/java/com/ivy/wallet/ui/loan/LoanBottomBar.kt index fefa1b63e4..1da0afa3d2 100644 --- a/app/src/main/java/com/ivy/wallet/ui/loan/LoanBottomBar.kt +++ b/app/src/main/java/com/ivy/wallet/ui/loan/LoanBottomBar.kt @@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import com.ivy.wallet.R import com.ivy.wallet.ui.IvyWalletPreview @@ -20,7 +21,7 @@ internal fun BoxWithConstraintsScope.LoanBottomBar( ) { BackBottomBar(onBack = onClose) { IvyButton( - text = "Add loan", + text = stringResource(R.string.add_loan), iconStart = R.drawable.ic_plus ) { onAdd() diff --git a/app/src/main/java/com/ivy/wallet/ui/loan/LoansScreen.kt b/app/src/main/java/com/ivy/wallet/ui/loan/LoansScreen.kt index a5694cfcce..9469325d4b 100644 --- a/app/src/main/java/com/ivy/wallet/ui/loan/LoansScreen.kt +++ b/app/src/main/java/com/ivy/wallet/ui/loan/LoansScreen.kt @@ -12,6 +12,7 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.platform.testTag +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview @@ -92,9 +93,8 @@ private fun BoxWithConstraintsScope.UI( Spacer(Modifier.weight(1f)) NoLoansEmptyState( - emptyStateTitle = "No loans", - emptyStateText = "You don't have any loans.\n" + - "Tap the \"+ Add loan\" to add one." + emptyStateTitle = stringResource(R.string.no_loans), + emptyStateText = stringResource(R.string.no_loans_description) ) Spacer(Modifier.weight(1f)) @@ -166,7 +166,7 @@ private fun Toolbar( .padding(start = 24.dp, end = 16.dp) ) { Text( - text = "Loans", + text = stringResource(R.string.loans), style = UI.typo.h2.style( color = UI.colors.pureInverse, fontWeight = FontWeight.ExtraBold diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8df4da89e4..e8b0491ed4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -109,4 +109,7 @@ Set currency No transactions You don\'t have any transactions for %1$s.\nYou can add one by tapping the \"+\" button. + Add loan + No loans + You don\'t have any loans.\nTap the \"+ Add loan\" to add one. From fbf877071d209ff625cd15c726cfe79cbba71c45 Mon Sep 17 00:00:00 2001 From: code-a1 <68858676+code-a1@users.noreply.github.com> Date: Wed, 20 Apr 2022 20:11:07 +0200 Subject: [PATCH 4/4] Added strings in strings.xml --- .../ui/loandetails/LoanDetailsScreen.kt | 25 ++++++++++--------- app/src/main/res/values/strings.xml | 10 ++++++++ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/ivy/wallet/ui/loandetails/LoanDetailsScreen.kt b/app/src/main/java/com/ivy/wallet/ui/loandetails/LoanDetailsScreen.kt index 664946a5b3..39872471fb 100644 --- a/app/src/main/java/com/ivy/wallet/ui/loandetails/LoanDetailsScreen.kt +++ b/app/src/main/java/com/ivy/wallet/ui/loandetails/LoanDetailsScreen.kt @@ -16,6 +16,7 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.platform.testTag +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview @@ -242,16 +243,16 @@ private fun BoxWithConstraintsScope.UI( DeleteModal( visible = deleteModalVisible, - title = "Confirm deletion", - description = "Note: Deleting this loan will remove it permanently and delete all associated loan records with it.", + title = stringResource(R.string.confirm_deletion), + description = stringResource(R.string.confirm_loan_deletion_description), dismiss = { deleteModalVisible = false } ) { onDeleteLoan() } ProgressModal( - title = "Confirm Account Change", - description = "Please wait, re-calculating all loan records", + title = stringResource(R.string.confirm_account_change), + description = stringResource(R.string.confirm_account_loan_change), visible = waitModalVisible ) } @@ -404,7 +405,7 @@ private fun LoanInfoCard( ) { Text( modifier = Modifier.padding(top = 8.dp, start = 24.dp), - text = "Paid", + text = stringResource(R.string.paid), style = UI.typo.c.style( color = contrastColor, fontWeight = FontWeight.ExtraBold @@ -484,7 +485,7 @@ private fun LoanInfoCard( Text( modifier = Modifier .testTag("left_to_pay"), - text = "${leftToPay.format(baseCurrency)} $baseCurrency left", + text = stringResource(R.string.left_to_pay), style = UI.typo.nB2.style( color = Gray, fontWeight = FontWeight.ExtraBold @@ -515,7 +516,7 @@ private fun LoanInfoCard( Text( modifier = Modifier.padding(horizontal = 24.dp), - text = "Loan Interest", + text = stringResource(R.string.loan_interest), style = UI.typo.c.style( color = contrastColor, fontWeight = FontWeight.ExtraBold @@ -545,7 +546,7 @@ private fun LoanInfoCard( Text( modifier = Modifier .testTag("interest_paid"), - text = "${loanAmountPaid.format(baseCurrency)} $baseCurrency paid", + text = stringResource(R.string.interest_paid, loanAmountPaid.format(baseCurrency), baseCurrency), style = UI.typo.nB2.style( color = Gray, fontWeight = FontWeight.ExtraBold @@ -572,7 +573,7 @@ private fun LoanInfoCard( .fillMaxWidth() .padding(horizontal = 16.dp) .align(Alignment.CenterHorizontally), - text = "Add record", + text = stringResource(R.string.add_record), shadowAlpha = 0.1f, backgroundGradient = Gradient.solid(contrastColor), textStyle = UI.typo.b2.style( @@ -671,7 +672,7 @@ private fun LoanRecordItem( backgroundGradient = Gradient.solid(loan.color.toComposeColor()), hasGlow = false, iconTint = textIconColor, - text = "Interest", + text = stringResource(R.string.interest), iconStart = getCustomIconIdS( iconName = "currency", defaultIcon = R.drawable.ic_currency @@ -754,7 +755,7 @@ private fun NoLoanRecordsEmptyState() { Spacer(Modifier.height(24.dp)) Text( - text = "No records", + text = stringResource(R.string.no_records), style = UI.typo.b1.style( color = Gray, fontWeight = FontWeight.ExtraBold @@ -765,7 +766,7 @@ private fun NoLoanRecordsEmptyState() { Text( modifier = Modifier.padding(horizontal = 32.dp), - text = "You don't have any records for this loan. Tap \"Add record\" to create one.", + text = stringResource(R.string.no_records_for_the_loan), style = UI.typo.b2.style( color = Gray, fontWeight = FontWeight.Medium, diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e8b0491ed4..77b397e235 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -112,4 +112,14 @@ Add loan No loans You don\'t have any loans.\nTap the \"+ Add loan\" to add one. + Note: Deleting this loan will remove it permanently and delete all associated loan records with it. + Please wait, re-calculating all loan records + Paid + %1$s %2$s left + Loan Interest + %1$s %2$s paid + Add record + Interest + No records + You don\'t have any records for this loan. Tap "Add record" to create one.