Updated UI text to English and improved currency formatting

The UI strings in `ExpenseDetailScreen`, `DashboardScreen`, and `AccountSelectionScreen` have been translated from German to English.

Additionally, currency display logic has been updated to use `String.format("%.2f€", ...)` for consistent two-decimal formatting across the `ExpenseDetailScreen` and `DashboardScreen`.
This commit is contained in:
2026-03-04 14:22:21 +01:00
parent ea6349c85c
commit 25d1038c9d
3 changed files with 16 additions and 13 deletions

View File

@@ -43,7 +43,7 @@ fun AccountSelectionScreen(accounts: List<Account>, onAccountClick: (Account) ->
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
item {
Text("Wähle einen Account", style = MaterialTheme.typography.headlineSmall)
Text("Choose an account", style = MaterialTheme.typography.headlineSmall)
}
items(accounts) { account ->
@@ -64,7 +64,7 @@ fun AccountSelectionScreen(accounts: List<Account>, onAccountClick: (Account) ->
onClick = onAddAccountClick,
modifier = Modifier.fillMaxWidth()
) {
Text("Anderen Account hinzufügen")
Text("Add account")
}
}
}

View File

@@ -1,5 +1,6 @@
package de.miaurizius.shap_planner.ui.screens
import android.annotation.SuppressLint
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
@@ -83,29 +84,29 @@ fun DashboardScreen(
) {
Column {
Text(
text = "Hallo, ${account.name}!",
text = "Hello, ${account.name}!",
style = MaterialTheme.typography.headlineMedium
)
Text(
text = "WG: ${account.wgName}",
text = "Household: ${account.wgName}",
style = MaterialTheme.typography.bodyLarge,
color = Color.Gray
)
}
Button(onClick = onBack) {
Text("Wechseln")
Text("Switch")
}
}
Spacer(modifier = Modifier.height(5.dp))
Button(onClick = onDelete) {
Text("Löschen")
Text("Delete")
}
Spacer(modifier = Modifier.height(10.dp))
Text("WG-Kosten", style = MaterialTheme.typography.titleLarge)
Text("Costs", style = MaterialTheme.typography.titleLarge)
Spacer(modifier = Modifier.height(8.dp))
if(expenseResource is Resource.Loading && expenseResource.data?.isEmpty() == true) {
@@ -113,7 +114,7 @@ fun DashboardScreen(
}
if(expenseResource is Resource.Error) {
Text("Fehler: ${expenseResource.message}", color = Color.Red)
Text("Error: ${expenseResource.message}", color = Color.Red)
}
LazyColumn(
@@ -142,6 +143,7 @@ fun DashboardScreen(
}
}
@SuppressLint("DefaultLocale")
@Composable
fun ExpenseItem(expense: Expense, onClick: () -> Unit) {
Surface(modifier = Modifier
@@ -151,7 +153,7 @@ fun ExpenseItem(expense: Expense, onClick: () -> Unit) {
color = MaterialTheme.colorScheme.surface) {
Row(modifier = Modifier.padding(16.dp), horizontalArrangement = Arrangement.SpaceBetween) {
Text(text = expense.title, style = MaterialTheme.typography.bodyLarge)
Text(text = expense.amount.toString()+"", style = MaterialTheme.typography.bodyLarge, fontWeight = FontWeight.Bold)
Text(text = String.format("%.2f€", expense.amount / 100.0), style = MaterialTheme.typography.bodyLarge, fontWeight = FontWeight.Bold)
}
}
}

View File

@@ -36,6 +36,7 @@ import de.miaurizius.shap_planner.entities.Account
import de.miaurizius.shap_planner.entities.Expense
import de.miaurizius.shap_planner.viewmodels.ExpenseDetailViewModel
@SuppressLint("DefaultLocale")
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ExpenseDetailScreen(
@@ -55,14 +56,14 @@ fun ExpenseDetailScreen(
TopAppBar(
title = { Text(expense.title) },
navigationIcon = { IconButton(onClick = onBack) {
Icon(Icons.AutoMirrored.Filled.ArrowBack, "Zurück")
Icon(Icons.AutoMirrored.Filled.ArrowBack, "Back")
} }
)
}
) { padding ->
Column(modifier = Modifier.padding(padding).padding(16.dp)) {
Text(
text = "${expense.amount / 100.0}",
text = String.format("%.2f€", expense.amount / 100.0),
style = MaterialTheme.typography.displayMedium,
fontWeight = FontWeight.Bold,
color = MaterialTheme.colorScheme.primary
@@ -73,12 +74,12 @@ fun ExpenseDetailScreen(
HorizontalDivider(Modifier, DividerDefaults.Thickness, DividerDefaults.color)
Spacer(modifier = Modifier.height(16.dp))
Text("Kostenaufteilung", style = MaterialTheme.typography.titleLarge)
Text("Cost Allocation", style = MaterialTheme.typography.titleLarge)
Spacer(modifier = Modifier.height(8.dp))
LazyColumn(verticalArrangement = Arrangement.spacedBy(8.dp)) {
items(shares) { item ->
ShareItem(item.user?.name ?: "Unbekannter Nutzer", item.share.share_cents)
ShareItem(item.user?.name ?: "Unknown User", item.share.share_cents)
}
}
}