Make strings translatable

This commit is contained in:
MM20 2025-06-18 22:33:02 +02:00
parent cbd4423428
commit fb85b49798
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
2 changed files with 10 additions and 20 deletions

View File

@ -136,7 +136,7 @@ fun TypographySettingsScreen(themeId: UUID) {
if (theme == null || previewTypography == null) return@PreferenceScreen if (theme == null || previewTypography == null) return@PreferenceScreen
item { item {
PreferenceCategory(title = "Fonts") { PreferenceCategory(title = stringResource(R.string.preference_typography_fonts)) {
FontPreference(title = "Brand", theme!!.fonts["brand"], onValueChange = { FontPreference(title = "Brand", theme!!.fonts["brand"], onValueChange = {
viewModel.updateTypography( viewModel.updateTypography(
theme!!.copy( theme!!.copy(
@ -692,7 +692,7 @@ private fun FontPreference(
item { item {
FontPickerCategory( FontPickerCategory(
preview.ExtraShort, preview.ExtraShort,
"Device default", stringResource(R.string.font_category_device_default),
fonts.deviceDefault, fonts.deviceDefault,
onFontClick = { onFontClick = {
scope.launch { scope.launch {
@ -703,26 +703,11 @@ private fun FontPreference(
}) })
} }
} }
if (fonts.system.isNotEmpty()) {
item {
FontPickerCategory(
preview.ExtraShort,
"System",
fonts.system,
onFontClick = {
scope.launch {
sheetState.hide()
onValueChange(it)
showDialog = false
}
})
}
}
if (fonts.generic.isNotEmpty()) { if (fonts.generic.isNotEmpty()) {
item { item {
FontPickerCategory( FontPickerCategory(
preview.ExtraShort, preview.ExtraShort,
"Generic", stringResource(R.string.font_category_generic),
fonts.generic, fonts.generic,
onFontClick = { onFontClick = {
scope.launch { scope.launch {
@ -780,8 +765,8 @@ private fun FontPickerCategory(
private fun getFontName(context: Context, fontFamily: ThemeFontFamily?): String { private fun getFontName(context: Context, fontFamily: ThemeFontFamily?): String {
return when (fontFamily) { return when (fontFamily) {
is ThemeFontFamily.LauncherDefault -> "Outfit" is ThemeFontFamily.LauncherDefault -> "Outfit"
is ThemeFontFamily.DeviceHeadline -> "Default headline font" is ThemeFontFamily.DeviceHeadline -> context.getString(R.string.font_name_device_headline)
is ThemeFontFamily.DeviceBody -> "Default text font" is ThemeFontFamily.DeviceBody -> context.getString(R.string.font_name_device_body)
is ThemeFontFamily.System -> fontFamily.name is ThemeFontFamily.System -> fontFamily.name
is ThemeFontFamily.SansSerif -> "sans-serif" is ThemeFontFamily.SansSerif -> "sans-serif"
is ThemeFontFamily.Serif -> "serif" is ThemeFontFamily.Serif -> "serif"

View File

@ -1043,4 +1043,9 @@
<string name="theme_import_title">Import theme</string> <string name="theme_import_title">Import theme</string>
<string name="theme_bundle_name">Name</string> <string name="theme_bundle_name">Name</string>
<string name="theme_bundle_author">Author</string> <string name="theme_bundle_author">Author</string>
<string name="preference_typography_fonts">Fonts</string>
<string name="font_category_device_default">Device default</string>
<string name="font_name_device_headline">Default headline font</string>
<string name="font_name_device_body">Device text font</string>
<string name="font_category_generic">Generic</string>
</resources> </resources>