1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-29 19:20:36 +02:00

Translate new dialog strings

This commit is contained in:
oliexdev
2025-08-14 12:25:21 +02:00
parent 28725e9ba3
commit 38185c26c9
8 changed files with 44 additions and 20 deletions

View File

@@ -41,8 +41,10 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.Dialog
import com.health.openscale.R
val tangoColors = listOf( val tangoColors = listOf(
Color(0xFFEF2929), Color(0xFFF57900), Color(0xFFFFCE44), Color(0xFF8AE234), Color(0xFFEF2929), Color(0xFFF57900), Color(0xFFFFCE44), Color(0xFF8AE234),
@@ -70,7 +72,7 @@ fun ColorPickerDialog(
.fillMaxWidth() .fillMaxWidth()
) { ) {
Column(modifier = Modifier.padding(16.dp)) { Column(modifier = Modifier.padding(16.dp)) {
Text("Farbe auswählen", style = MaterialTheme.typography.titleMedium) Text(stringResource(R.string.dialog_title_select_color), style = MaterialTheme.typography.titleMedium)
Spacer(modifier = Modifier.height(16.dp)) Spacer(modifier = Modifier.height(16.dp))
LazyVerticalGrid( LazyVerticalGrid(
@@ -108,7 +110,7 @@ fun ColorPickerDialog(
horizontalArrangement = Arrangement.End horizontalArrangement = Arrangement.End
) { ) {
TextButton(onClick = onDismiss) { TextButton(onClick = onDismiss) {
Text("Abbrechen") Text(stringResource(R.string.cancel_button))
} }
} }
} }

View File

@@ -38,7 +38,9 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.health.openscale.R
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
@@ -66,12 +68,12 @@ fun DateInputDialog(
} }
} }
) { ) {
Text("OK") Text(stringResource(R.string.dialog_ok))
} }
}, },
dismissButton = { dismissButton = {
TextButton(onClick = onDismiss) { TextButton(onClick = onDismiss) {
Text("Abbrechen") Text(stringResource(R.string.cancel_button))
} }
}, },
title = { title = {

View File

@@ -35,6 +35,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.health.openscale.R import com.health.openscale.R
@@ -83,7 +84,7 @@ fun IconPickerDialog(
AlertDialog( AlertDialog(
onDismissRequest = onDismiss, onDismissRequest = onDismiss,
title = { Text("Icon auswählen") }, title = { Text(stringResource(R.string.dialog_title_select_icon))},
text = { text = {
LazyVerticalGrid( LazyVerticalGrid(
columns = GridCells.Fixed(4), columns = GridCells.Fixed(4),
@@ -109,7 +110,7 @@ fun IconPickerDialog(
} }
}, },
confirmButton = { confirmButton = {
TextButton(onClick = onDismiss) { Text("Abbrechen") } TextButton(onClick = onDismiss) { Text(stringResource(R.string.cancel_button)) }
} }
) )
} }

View File

@@ -46,8 +46,10 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.health.openscale.R
import com.health.openscale.core.data.InputFieldType import com.health.openscale.core.data.InputFieldType
@Composable @Composable
@@ -69,12 +71,12 @@ fun NumberInputDialog(
onConfirm(value) onConfirm(value)
onDismiss() onDismiss()
}) { }) {
Text("OK") Text(stringResource(R.string.dialog_ok))
} }
}, },
dismissButton = { dismissButton = {
TextButton(onClick = onDismiss) { TextButton(onClick = onDismiss) {
Text("Abbrechen") Text(stringResource(R.string.cancel_button))
} }
}, },
title = { title = {
@@ -101,7 +103,7 @@ fun NumberInputDialog(
OutlinedTextField( OutlinedTextField(
value = value, value = value,
onValueChange = { value = it }, onValueChange = { value = it },
label = { Text("Wert eingeben") }, label = { Text(stringResource(R.string.dialog_title_input_value)) },
keyboardOptions = KeyboardOptions.Default.copy( keyboardOptions = KeyboardOptions.Default.copy(
keyboardType = when (inputType) { keyboardType = when (inputType) {
InputFieldType.FLOAT -> KeyboardType.Decimal InputFieldType.FLOAT -> KeyboardType.Decimal
@@ -114,7 +116,7 @@ fun NumberInputDialog(
Column { Column {
Icon( Icon(
imageVector = Icons.Default.KeyboardArrowUp, imageVector = Icons.Default.KeyboardArrowUp,
contentDescription = "Erhöhen", contentDescription = stringResource(R.string.trend_increased_desc),
modifier = Modifier modifier = Modifier
.size(24.dp) .size(24.dp)
.clickable { .clickable {
@@ -123,7 +125,7 @@ fun NumberInputDialog(
) )
Icon( Icon(
imageVector = Icons.Default.KeyboardArrowDown, imageVector = Icons.Default.KeyboardArrowDown,
contentDescription = "Verringern", contentDescription = stringResource(R.string.trend_decreased_desc),
modifier = Modifier modifier = Modifier
.size(24.dp) .size(24.dp)
.clickable { .clickable {

View File

@@ -41,7 +41,9 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.health.openscale.R
@Composable @Composable
fun TextInputDialog( fun TextInputDialog(
@@ -60,10 +62,10 @@ fun TextInputDialog(
TextButton(onClick = { TextButton(onClick = {
onConfirm(value) onConfirm(value)
onDismiss() onDismiss()
}) { Text("OK") } }) { Text(stringResource(R.string.dialog_ok)) }
}, },
dismissButton = { dismissButton = {
TextButton(onClick = onDismiss) { Text("Abbrechen") } TextButton(onClick = onDismiss) { Text(stringResource(R.string.cancel_button)) }
}, },
title = { title = {
Row(verticalAlignment = Alignment.CenterVertically) { Row(verticalAlignment = Alignment.CenterVertically) {
@@ -89,7 +91,7 @@ fun TextInputDialog(
OutlinedTextField( OutlinedTextField(
value = value, value = value,
onValueChange = { value = it }, onValueChange = { value = it },
label = { Text("Text eingeben") }, label = { Text(stringResource(R.string.dialog_title_input_text)) },
singleLine = true, singleLine = true,
modifier = Modifier.fillMaxWidth() modifier = Modifier.fillMaxWidth()
) )

View File

@@ -47,9 +47,11 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.health.openscale.R
import java.util.Calendar import java.util.Calendar
@Composable @Composable
@@ -78,12 +80,12 @@ fun TimeInputDialog(
onConfirm(updatedCal.timeInMillis) onConfirm(updatedCal.timeInMillis)
onDismiss() onDismiss()
}) { }) {
Text("OK") Text(stringResource(R.string.dialog_ok))
} }
}, },
dismissButton = { dismissButton = {
TextButton(onClick = onDismiss) { TextButton(onClick = onDismiss) {
Text("Abbrechen") Text(stringResource(R.string.cancel_button))
} }
}, },
title = { title = {
@@ -112,14 +114,14 @@ fun TimeInputDialog(
horizontalArrangement = Arrangement.spacedBy(16.dp) horizontalArrangement = Arrangement.spacedBy(16.dp)
) { ) {
TimeField( TimeField(
label = "Stunde", label = stringResource(R.string.dialog_title_hour),
value = hour, value = hour,
onValueChange = { hour = it.coerceIn(0, 23) }, onValueChange = { hour = it.coerceIn(0, 23) },
onIncrement = { hour = (hour + 1) % 24 }, onIncrement = { hour = (hour + 1) % 24 },
onDecrement = { hour = (hour + 23) % 24 } onDecrement = { hour = (hour + 23) % 24 }
) )
TimeField( TimeField(
label = "Minute", label = stringResource(R.string.dialog_title_minute),
value = minute, value = minute,
onValueChange = { minute = it.coerceIn(0, 59) }, onValueChange = { minute = it.coerceIn(0, 59) },
onIncrement = { minute = (minute + 1) % 60 }, onIncrement = { minute = (minute + 1) % 60 },
@@ -154,10 +156,10 @@ private fun TimeField(
Row { Row {
IconButton(onClick = onIncrement) { IconButton(onClick = onIncrement) {
Icon(Icons.Default.KeyboardArrowUp, contentDescription = "Stunde erhöhen") Icon(Icons.Default.KeyboardArrowUp, contentDescription = stringResource(R.string.trend_increased_desc))
} }
IconButton(onClick = onDecrement) { IconButton(onClick = onDecrement) {
Icon(Icons.Default.KeyboardArrowDown, contentDescription = "Stunde verringern") Icon(Icons.Default.KeyboardArrowDown, contentDescription = stringResource(R.string.trend_decreased_desc))
} }
} }
} }

View File

@@ -87,6 +87,12 @@
<string name="dialog_title_edit_value">%1$s bearbeiten</string> <!-- Beispiel: "Gewicht bearbeiten" --> <string name="dialog_title_edit_value">%1$s bearbeiten</string> <!-- Beispiel: "Gewicht bearbeiten" -->
<string name="dialog_title_change_date">%1$s ändern</string> <!-- Beispiel: "Datum ändern" oder "Messdatum ändern" --> <string name="dialog_title_change_date">%1$s ändern</string> <!-- Beispiel: "Datum ändern" oder "Messdatum ändern" -->
<string name="dialog_title_change_time">%1$s ändern</string> <!-- Beispiel: "Zeit ändern" oder "Messzeit ändern" --> <string name="dialog_title_change_time">%1$s ändern</string> <!-- Beispiel: "Zeit ändern" oder "Messzeit ändern" -->
<string name="dialog_title_select_color">Farbe auswählen</string>
<string name="dialog_title_select_icon">Symbol auswählen</string>
<string name="dialog_title_input_value">Wert eingeben</string>
<string name="dialog_title_input_text">Text eingeben</string>
<string name="dialog_title_hour">Stunde</string>
<string name="dialog_title_minute">Minute</string>
<string name="label_date">Datum</string> <string name="label_date">Datum</string>
<string name="label_time">Uhrzeit</string> <string name="label_time">Uhrzeit</string>

View File

@@ -88,6 +88,13 @@
<string name="dialog_title_edit_value">Edit %1$s</string> <!-- Example: "Edit Weight" --> <string name="dialog_title_edit_value">Edit %1$s</string> <!-- Example: "Edit Weight" -->
<string name="dialog_title_change_date">Change %1$s</string> <!-- Example: "Change Date" or "Change Measurement Date" --> <string name="dialog_title_change_date">Change %1$s</string> <!-- Example: "Change Date" or "Change Measurement Date" -->
<string name="dialog_title_change_time">Change %1$s</string> <!-- Example: "Change Time" or "Change Measurement Time" --> <string name="dialog_title_change_time">Change %1$s</string> <!-- Example: "Change Time" or "Change Measurement Time" -->
<string name="dialog_title_select_color">Select color</string>
<string name="dialog_title_select_icon">Select icon</string>
<string name="dialog_title_input_value">Input value</string>
<string name="dialog_title_input_text">Input text</string>
<string name="dialog_title_hour">Hour</string>
<string name="dialog_title_minute">Minute</string>
<string name="label_date">Date</string> <string name="label_date">Date</string>
<string name="label_time">Time</string> <string name="label_time">Time</string>