Make strings translatable

This commit is contained in:
MM20 2023-08-27 00:05:13 +02:00
parent c192b3c1fc
commit e4f5ec4625
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
5 changed files with 17 additions and 7 deletions

View File

@ -28,7 +28,9 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import de.mm20.launcher2.ui.R
import de.mm20.launcher2.ui.component.BottomSheetDialog
import de.mm20.launcher2.ui.component.colorpicker.HctColorPicker
import de.mm20.launcher2.ui.component.colorpicker.rememberHctColorPickerState
@ -68,7 +70,7 @@ fun CorePaletteColorPreference(
) {
SwitchPreference(
icon = Icons.Rounded.SettingsSuggest,
title = "Use system default",
title = stringResource(R.string.custom_color_scheme_system_default),
value = currentValue == null,
onValueChanged = {
currentValue = if (it) null else defaultValue
@ -124,7 +126,7 @@ fun CorePaletteColorPreference(
.padding(ButtonDefaults.IconSpacing)
.size(ButtonDefaults.IconSize)
)
Text("From primary color")
Text(stringResource(R.string.custom_color_scheme_autogenerate))
}
}
}

View File

@ -45,6 +45,7 @@ import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.drawscope.Fill
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import de.mm20.launcher2.themes.ColorRef
@ -53,6 +54,7 @@ import de.mm20.launcher2.themes.FullCorePalette
import de.mm20.launcher2.themes.StaticColor
import de.mm20.launcher2.themes.atTone
import de.mm20.launcher2.themes.get
import de.mm20.launcher2.ui.R
import de.mm20.launcher2.ui.component.BottomSheetDialog
import de.mm20.launcher2.ui.component.colorpicker.HctColorPicker
import de.mm20.launcher2.ui.component.colorpicker.rememberHctColorPickerState
@ -119,7 +121,7 @@ fun ThemeColorPreference(
},
shape = SegmentedButtonDefaults.shape(position = 0, count = 2)
) {
Text("From palette")
Text(stringResource(R.string.custom_color_scheme_palette_color))
}
SegmentedButton(
selected = actualValue is StaticColor,
@ -140,7 +142,7 @@ fun ThemeColorPreference(
},
shape = SegmentedButtonDefaults.shape(position = 1, count = 2)
) {
Text("Custom")
Text(stringResource(R.string.custom_color_scheme_custom_color))
}
}
AnimatedContent(
@ -412,7 +414,7 @@ fun ThemeColorPreference(
.padding(ButtonDefaults.IconSpacing)
.size(ButtonDefaults.IconSize)
)
Text("Restore default")
Text(stringResource(R.string.preference_restore_default))
}
}
}

View File

@ -231,7 +231,7 @@ fun ThemeSettingsScreen(themeId: UUID) {
},
)
CorePaletteColorPreference(
title = "NeutralVariant",
title = "Neutral Variant",
value = theme?.corePalette?.neutralVariant,
onValueChange = {
viewModel.updateTheme(

View File

@ -108,7 +108,7 @@ fun ThemesSettingsScreen() {
leadingIcon = {
Icon(Icons.Rounded.Edit, null)
},
text = { Text("Edit") },
text = { Text(stringResource(R.string.edit)) },
onClick = {
navController?.navigate("settings/appearance/themes/${theme.id}")
showMenu = false

View File

@ -248,6 +248,7 @@
<string name="close">Close</string>
<string name="save">Save</string>
<string name="duplicate">Duplicate</string>
<string name="edit">Edit</string>
<string name="skip">Skip</string>
<string name="action_continue">Continue</string>
<string name="action_next">Next</string>
@ -830,4 +831,9 @@
<string name="note_widget_file_write_error_description">The note could not be written to the linked file. Possibly, it has been moved or deleted. A copy has been saved to the launcher\'s internal storage.</string>
<string name="confirmation_delete_color_scheme">Do you really want to delete the color scheme %1$s?</string>
<string name="new_color_scheme_name">New color scheme</string>
<string name="custom_color_scheme_system_default">Use system default</string>
<string name="custom_color_scheme_autogenerate">From primary color</string>
<string name="custom_color_scheme_palette_color">Palette</string>
<string name="custom_color_scheme_custom_color">Custom</string>
<string name="preference_restore_default">Restore default</string>
</resources>