From 6d351dcb8a2cd73ae82633c605b4835d7450df11 Mon Sep 17 00:00:00 2001 From: code-a1 <68858676+code-a1@users.noreply.github.com> Date: Mon, 25 Apr 2022 23:14:02 +0200 Subject: [PATCH] Added hard-coded strings in strings.xml and optimized italian translation --- .../ivy/wallet/domain/data/IntervalType.kt | 10 +-- .../deprecated/logic/PreloadDataLogic.kt | 62 ++++++++++--------- .../main/java/com/ivy/wallet/utils/DateExt.kt | 4 +- .../res/layout/widget_add_transaction.xml | 6 +- app/src/main/res/values-it/strings.xml | 15 ++++- app/src/main/res/values/strings.xml | 9 +++ 6 files changed, 64 insertions(+), 42 deletions(-) diff --git a/app/src/main/java/com/ivy/wallet/domain/data/IntervalType.kt b/app/src/main/java/com/ivy/wallet/domain/data/IntervalType.kt index 85063fcb63..c3653223aa 100644 --- a/app/src/main/java/com/ivy/wallet/domain/data/IntervalType.kt +++ b/app/src/main/java/com/ivy/wallet/domain/data/IntervalType.kt @@ -1,5 +1,7 @@ package com.ivy.wallet.domain.data +import com.ivy.wallet.R +import com.ivy.wallet.stringRes import java.time.LocalDateTime enum class IntervalType { @@ -8,10 +10,10 @@ enum class IntervalType { fun forDisplay(intervalN: Int): String { val plural = intervalN > 1 || intervalN == 0 return when (this) { - DAY -> if (plural) "days" else "day" - WEEK -> if (plural) "weeks" else "week" - MONTH -> if (plural) "months" else "month" - YEAR -> if (plural) "years" else "year" + DAY -> if (plural) stringRes(R.string.days) else stringRes(R.string.day) + WEEK -> if (plural) stringRes(R.string.weeks) else stringRes(R.string.week) + MONTH -> if (plural) stringRes(R.string.months) else stringRes(R.string.month) + YEAR -> if (plural) stringRes(R.string.years) else stringRes(R.string.year) } } diff --git a/app/src/main/java/com/ivy/wallet/domain/deprecated/logic/PreloadDataLogic.kt b/app/src/main/java/com/ivy/wallet/domain/deprecated/logic/PreloadDataLogic.kt index 2ebd1831f5..963fba05fe 100644 --- a/app/src/main/java/com/ivy/wallet/domain/deprecated/logic/PreloadDataLogic.kt +++ b/app/src/main/java/com/ivy/wallet/domain/deprecated/logic/PreloadDataLogic.kt @@ -1,12 +1,14 @@ package com.ivy.wallet.domain.deprecated.logic import androidx.compose.ui.graphics.toArgb +import com.ivy.wallet.R import com.ivy.wallet.domain.data.core.Account import com.ivy.wallet.domain.data.core.Category import com.ivy.wallet.domain.deprecated.logic.model.CreateAccountData import com.ivy.wallet.domain.deprecated.logic.model.CreateCategoryData import com.ivy.wallet.io.persistence.dao.AccountDao import com.ivy.wallet.io.persistence.dao.CategoryDao +import com.ivy.wallet.stringRes import com.ivy.wallet.ui.onboarding.model.AccountBalance import com.ivy.wallet.ui.theme.* @@ -24,7 +26,7 @@ class PreloadDataLogic( fun preloadAccounts() { val cash = Account( - name = "Cash", + name = stringRes(R.string.cash), currency = null, color = Green.toArgb(), icon = "cash", @@ -33,7 +35,7 @@ class PreloadDataLogic( ) val bank = Account( - name = "Bank", + name = stringRes(R.string.bank), currency = null, color = IvyDark.toArgb(), icon = "bank", @@ -47,21 +49,21 @@ class PreloadDataLogic( fun accountSuggestions(baseCurrency: String): List = listOf( CreateAccountData( - name = "Cash", + name = stringRes(R.string.cash), currency = baseCurrency, color = Green, icon = "cash", balance = 0.0 ), CreateAccountData( - name = "Bank", + name = stringRes(R.string.bank), currency = baseCurrency, color = IvyDark, icon = "bank", balance = 0.0 ), CreateAccountData( - name = "Revolut", + name = stringRes(R.string.revoult), currency = baseCurrency, color = Blue, icon = "revolut", @@ -81,61 +83,61 @@ class PreloadDataLogic( private fun preloadCategoriesCreateData() = listOf( CreateCategoryData( - name = "Food & Drinks", + name = stringRes(R.string.food_drinks), color = Green, icon = "fooddrink" ), CreateCategoryData( - name = "Bills & Fees", + name = stringRes(R.string.bills_fees), color = Red, icon = "bills" ), CreateCategoryData( - name = "Transport", + name = stringRes(R.string.transport), color = YellowLight, icon = "transport" ), CreateCategoryData( - name = "Groceries", + name = stringRes(R.string.groceries), color = GreenLight, icon = "groceries" ), CreateCategoryData( - name = "Entertainment", + name = stringRes(R.string.entertainment), color = Orange, icon = "game" ), CreateCategoryData( - name = "Shopping", + name = stringRes(R.string.shopping), color = Ivy, icon = "shopping" ), CreateCategoryData( - name = "Gifts", + name = stringRes(R.string.gifts), color = RedLight, icon = "gift" ), CreateCategoryData( - name = "Health", + name = stringRes(R.string.health), color = IvyLight, icon = "health" ), CreateCategoryData( - name = "Investments", + name = stringRes(R.string.investments), color = IvyDark, icon = "leaf" ), CreateCategoryData( - name = "Loans", + name = stringRes(R.string.loans), color = BlueDark, icon = "loan" ), @@ -159,91 +161,91 @@ class PreloadDataLogic( .plus( listOf( CreateCategoryData( - name = "Car", + name = stringRes(R.string.car), color = Blue3, icon = "vehicle" ), CreateCategoryData( - name = "Work", + name = stringRes(R.string.work), color = Blue2Light, icon = "work" ), CreateCategoryData( - name = "Home", + name = stringRes(R.string.home_category), color = Green2, icon = "house" ), CreateCategoryData( - name = "Restaurant", + name = stringRes(R.string.restaurant), color = Orange3, icon = "restaurant" ), CreateCategoryData( - name = "Family", + name = stringRes(R.string.family), color = Red3Light, icon = "family" ), CreateCategoryData( - name = "Social Life", + name = stringRes(R.string.social_life), color = Blue2, icon = "people" ), CreateCategoryData( - name = "Order food", + name = stringRes(R.string.order_food), color = Orange2, icon = "orderfood2" ), CreateCategoryData( - name = "Travel", + name = stringRes(R.string.travel), color = BlueLight, icon = "travel" ), CreateCategoryData( - name = "Fitness", + name = stringRes(R.string.fitness), color = Purple2, icon = "fitness" ), CreateCategoryData( - name = "Self-development", + name = stringRes(R.string.self_development), color = Yellow, icon = "selfdevelopment" ), CreateCategoryData( - name = "Clothes", + name = stringRes(R.string.clothes), color = Green2Light, icon = "clothes2" ), CreateCategoryData( - name = "Beauty", + name = stringRes(R.string.beauty), color = Red3, icon = "makeup" ), CreateCategoryData( - name = "Education", + name = stringRes(R.string.education), color = Blue, icon = "education" ), CreateCategoryData( - name = "Pet", + name = stringRes(R.string.pet), color = Orange3Light, icon = "pet" ), CreateCategoryData( - name = "Sports", + name = stringRes(R.string.sports), color = Purple1, icon = "sports" ), diff --git a/app/src/main/java/com/ivy/wallet/utils/DateExt.kt b/app/src/main/java/com/ivy/wallet/utils/DateExt.kt index 52195e84cb..b58998ebc5 100644 --- a/app/src/main/java/com/ivy/wallet/utils/DateExt.kt +++ b/app/src/main/java/com/ivy/wallet/utils/DateExt.kt @@ -77,13 +77,13 @@ fun LocalDateTime.formatNicelyWithTime( val today = dateNowUTC() val isThisYear = today.year == this.year - val patternNoWeekDay = "dd MMM 'at' HH:mm" + val patternNoWeekDay = "dd MMM HH:mm" if (noWeekDay) { return if (isThisYear) { this.formatLocal(patternNoWeekDay) } else { - this.formatLocal("dd MMM, yyyy 'at' HH:mm") + this.formatLocal("dd MMM, yyyy HH:mm") } } diff --git a/app/src/main/res/layout/widget_add_transaction.xml b/app/src/main/res/layout/widget_add_transaction.xml index 50be6d422b..ca997821c7 100644 --- a/app/src/main/res/layout/widget_add_transaction.xml +++ b/app/src/main/res/layout/widget_add_transaction.xml @@ -39,7 +39,7 @@ android:layout_marginTop="10dp" android:fontFamily="@font/raleway_bold" android:gravity="center" - android:text="Income" + android:text="@string/income" android:textColor="@color/white" android:textSize="12sp" /> @@ -68,7 +68,7 @@ android:layout_marginTop="10dp" android:fontFamily="@font/raleway_bold" android:gravity="center" - android:text="Expense" + android:text="@string/expense" android:textColor="@color/white" android:textSize="12sp" /> @@ -95,7 +95,7 @@ android:layout_marginTop="10dp" android:fontFamily="@font/raleway_bold" android:gravity="center" - android:text="Transfer" + android:text="@string/transfer" android:textColor="@color/white" android:textSize="12sp" /> diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 545e7604dd..67a4c0cd5e 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -295,7 +295,7 @@ Scegli il mese o un intervallo personalizzato Aggiungi una data - o nell’ultimo + o nell’ultimo periodo di o tutto il tempo Deseleziona tutto il tempo Seleziona tutto il tempo @@ -415,6 +415,15 @@ Ottobre Novembre Dicembre - - Tratta i trasferimenti di conto come entrate o spese nella schermata Conti + giorni + giorno + settimane + settimana + mesi + mese + anni + anno + + Tratta i trasferimenti di conto come entrate o uscite nella schermata dei conti + Casa diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6e5e8f55e9..21387e1633 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -415,6 +415,15 @@ October November December + days + day + weeks + week + months + month + years + year Treats account transfers as income or expense in Accounts Screen + Home