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.