Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #791 from code-a1/develop
Browse files Browse the repository at this point in the history
Added hard-coded strings in strings.xml and optimized italian translation
  • Loading branch information
ILIYANGERMANOV authored Apr 25, 2022
2 parents 833fa5f + 6d351dc commit acc13e5
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 42 deletions.
10 changes: 6 additions & 4 deletions app/src/main/java/com/ivy/wallet/domain/data/IntervalType.kt
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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.*

Expand All @@ -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",
Expand All @@ -33,7 +35,7 @@ class PreloadDataLogic(
)

val bank = Account(
name = "Bank",
name = stringRes(R.string.bank),
currency = null,
color = IvyDark.toArgb(),
icon = "bank",
Expand All @@ -47,21 +49,21 @@ class PreloadDataLogic(

fun accountSuggestions(baseCurrency: String): List<CreateAccountData> = 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",
Expand All @@ -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"
),
Expand All @@ -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"
),
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/ivy/wallet/utils/DateExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/widget_add_transaction.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />

Expand Down Expand Up @@ -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" />

Expand All @@ -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" />

Expand Down
15 changes: 12 additions & 3 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
<string name="choose_month">Scegli il mese</string>
<string name="or_custom_range">o un intervallo personalizzato</string>
<string name="add_date">Aggiungi una data</string>
<string name="or_in_the_last">o nell’ultimo</string>
<string name="or_in_the_last">o nell’ultimo periodo di</string>
<string name="or_all_time">o tutto il tempo</string>
<string name="unselect_all_time">Deseleziona tutto il tempo</string>
<string name="select_all_time">Seleziona tutto il tempo</string>
Expand Down Expand Up @@ -415,6 +415,15 @@
<string name="october">Ottobre</string>
<string name="november">Novembre</string>
<string name="december">Dicembre</string>
<string name="transfers_as_income_expense"><![CDATA[Trasferimenti come entrate e spese]]></string>
<string name="transfers_as_income_expense_description">Tratta i trasferimenti di conto come entrate o spese nella schermata Conti</string>
<string name="days">giorni</string>
<string name="day">giorno</string>
<string name="weeks">settimane</string>
<string name="week">settimana</string>
<string name="months">mesi</string>
<string name="month">mese</string>
<string name="years">anni</string>
<string name="year">anno</string>
<string name="transfers_as_income_expense"><![CDATA[Trasferimenti come entrate ed uscite]]></string>
<string name="transfers_as_income_expense_description">Tratta i trasferimenti di conto come entrate o uscite nella schermata dei conti</string>
<string name="home_category">Casa</string>
</resources>
9 changes: 9 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,15 @@
<string name="october">October</string>
<string name="november">November</string>
<string name="december">December</string>
<string name="days">days</string>
<string name="day">day</string>
<string name="weeks">weeks</string>
<string name="week">week</string>
<string name="months">months</string>
<string name="month">month</string>
<string name="years">years</string>
<string name="year">year</string>
<string name="transfers_as_income_expense"><![CDATA[Transfers as income & expenses]]></string>
<string name="transfers_as_income_expense_description">Treats account transfers as income or expense in Accounts Screen</string>
<string name="home_category">Home</string>
</resources>

0 comments on commit acc13e5

Please sign in to comment.