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 564b96fd5f..3090dff966 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 @@ -487,7 +487,7 @@ private fun BoxWithConstraintsScope.UI( DeleteModal( visible = deleteTrnModalVisible, title = stringResource(R.string.confirm_deletion), - description = stringResource(R.string.confirm_deletion_description), + description = stringResource(R.string.transaction_confirm_deletion_description), dismiss = { deleteTrnModalVisible = false } ) { onDelete() 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 39872471fb..7592822814 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 @@ -244,7 +244,7 @@ private fun BoxWithConstraintsScope.UI( DeleteModal( visible = deleteModalVisible, title = stringResource(R.string.confirm_deletion), - description = stringResource(R.string.confirm_loan_deletion_description), + description = stringResource(R.string.loan_confirm_deletion_description), dismiss = { deleteModalVisible = false } ) { onDeleteLoan() @@ -485,7 +485,7 @@ private fun LoanInfoCard( Text( modifier = Modifier .testTag("left_to_pay"), - text = stringResource(R.string.left_to_pay), + text = stringResource(R.string.left_to_pay, leftToPay.format(baseCurrency), baseCurrency), style = UI.typo.nB2.style( color = Gray, fontWeight = FontWeight.ExtraBold diff --git a/app/src/main/java/com/ivy/wallet/ui/statistic/level1/PieChartStatisticBottomBar.kt b/app/src/main/java/com/ivy/wallet/ui/statistic/level1/PieChartStatisticBottomBar.kt index 6cf42b9558..a26bc13305 100644 --- a/app/src/main/java/com/ivy/wallet/ui/statistic/level1/PieChartStatisticBottomBar.kt +++ b/app/src/main/java/com/ivy/wallet/ui/statistic/level1/PieChartStatisticBottomBar.kt @@ -7,6 +7,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.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp @@ -51,7 +52,7 @@ fun BoxWithConstraintsScope.PieChartStatisticBottomBar( val isIncome = type == TransactionType.INCOME IvyButton( iconStart = R.drawable.ic_plus, - text = if (isIncome) "Add income" else "Add expense", + text = if (isIncome) stringResource(id = R.string.add_income) else stringResource(id = R.string.add_expense), backgroundGradient = if (isIncome) GradientGreen else Gradient.solid(UI.colors.pureInverse), textStyle = UI.typo.b2.style( color = if (isIncome) White else UI.colors.pure, diff --git a/app/src/main/java/com/ivy/wallet/ui/statistic/level1/PieChartStatisticScreen.kt b/app/src/main/java/com/ivy/wallet/ui/statistic/level1/PieChartStatisticScreen.kt index 6c99171265..24ca1787a0 100644 --- a/app/src/main/java/com/ivy/wallet/ui/statistic/level1/PieChartStatisticScreen.kt +++ b/app/src/main/java/com/ivy/wallet/ui/statistic/level1/PieChartStatisticScreen.kt @@ -17,6 +17,7 @@ import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.toArgb +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 @@ -159,7 +160,9 @@ private fun BoxWithConstraintsScope.UI( Text( modifier = Modifier.padding(start = 32.dp), - text = if (transactionType == TransactionType.EXPENSE) "Expenses" else "Income", + text = if (transactionType == TransactionType.EXPENSE) stringResource(R.string.expenses) else stringResource( + R.string.income + ), style = UI.typo.b1.style( fontWeight = FontWeight.ExtraBold ) @@ -431,7 +434,7 @@ private fun CategoryAmountCard( modifier = Modifier .weight(1f) .padding(end = 16.dp), - text = category?.name ?: "Unspecified", + text = category?.name ?: stringResource(R.string.unspecified), style = UI.typo.b2.style( color = textColor, fontWeight = FontWeight.Bold, @@ -469,7 +472,9 @@ private fun PercentText( contrastColor: Color ) { Text( - text = if (totalAmount != 0.0) "${((amount / totalAmount) * 100).format(2)}%" else "0%", + text = if (totalAmount != 0.0) + stringResource(R.string.percent, ((amount / totalAmount) * 100).format(2)) + else stringResource(R.string.percent, "0"), style = UI.typo.nB2.style( color = if (selectedState) contrastColor else UI.colors.pureInverse, fontWeight = FontWeight.Normal @@ -524,7 +529,7 @@ private fun Preview_Expense() { ), ), selectedCategory = null, - checkForUnSpecifiedCategory = {false} + checkForUnSpecifiedCategory = { false } ) } } @@ -576,7 +581,7 @@ private fun Preview_Income() { ), ), selectedCategory = null, - checkForUnSpecifiedCategory = {false} + checkForUnSpecifiedCategory = { false } ) } } diff --git a/app/src/main/java/com/ivy/wallet/ui/statistic/level1/PieChartStatisticViewModel.kt b/app/src/main/java/com/ivy/wallet/ui/statistic/level1/PieChartStatisticViewModel.kt index fa501bdd51..0a0f898908 100644 --- a/app/src/main/java/com/ivy/wallet/ui/statistic/level1/PieChartStatisticViewModel.kt +++ b/app/src/main/java/com/ivy/wallet/ui/statistic/level1/PieChartStatisticViewModel.kt @@ -3,6 +3,7 @@ package com.ivy.wallet.ui.statistic.level1 import androidx.compose.ui.graphics.toArgb import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope +import com.ivy.wallet.R import com.ivy.wallet.domain.data.TransactionType import com.ivy.wallet.domain.data.entity.Category import com.ivy.wallet.domain.data.entity.Transaction @@ -16,6 +17,7 @@ import com.ivy.wallet.domain.logic.currency.sumInBaseCurrency import com.ivy.wallet.io.persistence.dao.CategoryDao import com.ivy.wallet.io.persistence.dao.SettingsDao import com.ivy.wallet.io.persistence.dao.TransactionDao +import com.ivy.wallet.stringRes import com.ivy.wallet.ui.IvyWalletCtx import com.ivy.wallet.ui.PieChartStatistic import com.ivy.wallet.ui.onboarding.model.FromToTimeRange @@ -74,7 +76,7 @@ class PieChartStatisticViewModel @Inject constructor( private var filterExcluded = true private val transfersCategory = - Category("Account Transfers", color = IvyLight.toArgb(), icon = "transfer") + Category(stringRes(R.string.account_transfers), color = IvyLight.toArgb(), icon = "transfer") fun start( screen: PieChartStatistic diff --git a/app/src/main/java/com/ivy/wallet/ui/statistic/level2/ItemStatisticScreen.kt b/app/src/main/java/com/ivy/wallet/ui/statistic/level2/ItemStatisticScreen.kt index a442cf8334..1a622fe669 100644 --- a/app/src/main/java/com/ivy/wallet/ui/statistic/level2/ItemStatisticScreen.kt +++ b/app/src/main/java/com/ivy/wallet/ui/statistic/level2/ItemStatisticScreen.kt @@ -15,6 +15,7 @@ import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.platform.LocalDensity 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 @@ -32,6 +33,7 @@ import com.ivy.wallet.domain.data.TransactionType 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.stringRes import com.ivy.wallet.ui.* import com.ivy.wallet.ui.onboarding.model.TimePeriod import com.ivy.wallet.ui.theme.* @@ -355,22 +357,21 @@ private fun BoxWithConstraintsScope.UI( (ivyContext.screenHeight * 0.7f).toDp() }, onPayOrGet = onPayOrGet, - emptyStateTitle = "No transactions", + emptyStateTitle = stringRes(R.string.no_transactions), + + emptyStateText = stringRes(R.string.no_transactions_for_period, period.toDisplayLong(ivyContext.startDayOfMonth)), - emptyStateText = "You don't have any transactions for ${ - period.toDisplayLong(ivyContext.startDayOfMonth) - }.\nYou can add one by scrolling down and tapping \"Add income\" or \"Add expense\" button at the top." ) } } DeleteModal( visible = deleteModalVisible, - title = "Confirm deletion", + title = stringResource(R.string.confirm_deletion), description = if (account != null) { - "Note: Deleting this account will remove it permanently and delete all associated transactions with it." + stringResource(R.string.account_confirm_deletion_description) } else { - "Note: Deleting this category will remove it permanently." + stringResource(R.string.category_confirm_deletion_description) }, dismiss = { deleteModalVisible = false } ) { @@ -562,7 +563,7 @@ fun ItemStatisticToolbar( IvyOutlinedButton( iconStart = R.drawable.ic_edit, - text = "Edit", + text = stringRes(R.string.edit), borderColor = contrastColor, iconTint = contrastColor, textColor = contrastColor, @@ -602,13 +603,13 @@ fun IncomeExpensesCards( Spacer(Modifier.width(16.dp)) HeaderCard( - title = "INCOME", + title = stringRes(R.string.income_uppercase), currencyCode = currency, amount = income, transactionCount = history .filterIsInstance(Transaction::class.java) .count { it.type == TransactionType.INCOME }, - addButtonText = if (hasAddButtons) "Add income" else null, + addButtonText = if (hasAddButtons) stringResource(R.string.add_income) else null, isIncome = true, itemColor = itemColor, @@ -620,13 +621,13 @@ fun IncomeExpensesCards( Spacer(Modifier.width(12.dp)) HeaderCard( - title = "EXPENSES", + title = stringRes(R.string.expenses_uppercase), currencyCode = currency, amount = expenses, transactionCount = history .filterIsInstance(Transaction::class.java) .count { it.type == TransactionType.EXPENSE }, - addButtonText = if (hasAddButtons) "Add expense" else null, + addButtonText = if (hasAddButtons) stringResource(R.string.add_expense) else null, isIncome = false, itemColor = itemColor, @@ -711,7 +712,7 @@ private fun RowScope.HeaderCard( ) Text( modifier = Modifier.padding(horizontal = 24.dp), - text = "transactions", + text = stringRes(R.string.transactions), style = UI.typo.b2.style( color = contrastColor, fontWeight = FontWeight.Normal @@ -794,7 +795,7 @@ private fun Item( modifier = Modifier .align(Alignment.Bottom) .padding(bottom = 12.dp), - text = "(excluded)", + text = stringRes(R.string.excluded), style = UI.typo.c.style( color = account.color.toComposeColor().dynamicContrast() ) diff --git a/app/src/main/java/com/ivy/wallet/ui/statistic/level2/ItemStatisticViewModel.kt b/app/src/main/java/com/ivy/wallet/ui/statistic/level2/ItemStatisticViewModel.kt index d8afc523e7..d3f4d9656b 100644 --- a/app/src/main/java/com/ivy/wallet/ui/statistic/level2/ItemStatisticViewModel.kt +++ b/app/src/main/java/com/ivy/wallet/ui/statistic/level2/ItemStatisticViewModel.kt @@ -4,6 +4,7 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import arrow.core.toOption import com.ivy.design.navigation.Navigation +import com.ivy.wallet.R import com.ivy.wallet.domain.data.TransactionHistoryItem import com.ivy.wallet.domain.data.TransactionType import com.ivy.wallet.domain.data.entity.Account @@ -20,6 +21,7 @@ import com.ivy.wallet.domain.logic.currency.ExchangeRatesLogic import com.ivy.wallet.domain.sync.uploader.AccountUploader import com.ivy.wallet.domain.sync.uploader.CategoryUploader import com.ivy.wallet.io.persistence.dao.* +import com.ivy.wallet.stringRes import com.ivy.wallet.ui.ItemStatistic import com.ivy.wallet.ui.IvyWalletCtx import com.ivy.wallet.ui.onboarding.model.TimePeriod @@ -429,7 +431,7 @@ class ItemStatisticViewModel @Inject constructor( val accountTransferCategoryEnabled = categoryId != null if (accountTransferCategoryEnabled) - _category.value = Category("Account Transfers") + _category.value = Category(stringRes(R.string.account_transfers)) val trans = transactions.filter { it.categoryId == null && (accountFilterIdSet.contains(it.accountId) || accountFilterIdSet.contains( diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 77b397e235..dae1a431c1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -85,7 +85,7 @@ Pay Get Confirm deletion - Deleting this transaction will remove it from the transaction history and update the balance accordingly. + 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 @@ -112,7 +112,7 @@ 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. + 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 @@ -122,4 +122,14 @@ Interest No records You don\'t have any records for this loan. Tap "Add record" to create one. + Add income + Add expense + Unspecified + %1$s% + Account Transfers + You don\'t have any transactions for %1$s.\nYou can add one by scrolling down and tapping "Add income" or "Add expense" button at the top. + Note: Deleting this account will remove it permanently and delete all associated transactions with it. + Note: Deleting this category will remove it permanently. + Edit + transactions