Skip to content

Commit 0483e2e

Browse files
committed
Welcome to Beta screen: Locale fix
1 parent 67da3ac commit 0483e2e

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

app/src/processing/app/ui/WelcomeToBeta.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,10 @@ class WelcomeToBeta {
9191
horizontalArrangement = Arrangement
9292
.spacedBy(20.dp)
9393
){
94+
val locale = LocalLocale.current
9495
Image(
9596
painter = painterResource("logo.svg"),
96-
contentDescription = "Processing Logo",
97+
contentDescription = locale["beta.logo"],
9798
modifier = Modifier
9899
.align(Alignment.CenterVertically)
99100
.size(100.dp, 100.dp)
@@ -107,7 +108,6 @@ class WelcomeToBeta {
107108
alignment = Alignment.CenterVertically
108109
)
109110
) {
110-
val locale = LocalLocale.current
111111
Text(
112112
text = locale["beta.title"],
113113
style = MaterialTheme.typography.subtitle1,

app/src/processing/app/ui/theme/Locale.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import androidx.compose.runtime.Composable
44
import androidx.compose.runtime.CompositionLocalProvider
55
import androidx.compose.runtime.compositionLocalOf
66
import processing.app.LocalPreferences
7+
import processing.app.Messages
78
import processing.app.Platform
89
import processing.app.PlatformStart
910
import processing.app.watchFile
@@ -21,10 +22,12 @@ class Locale(language: String = "") : Properties() {
2122
}
2223

2324
@Deprecated("Use get instead", ReplaceWith("get(key)"))
24-
override fun getProperty(key: String?): String {
25-
return super.getProperty(key)
25+
override fun getProperty(key: String?, default: String): String {
26+
val value = super.getProperty(key, default)
27+
if(value == default) Messages.log("Missing translation for $key")
28+
return value
2629
}
27-
operator fun get(key: String): String = getProperty(key)
30+
operator fun get(key: String): String = getProperty(key, key)
2831
}
2932
val LocalLocale = compositionLocalOf { Locale() }
3033
@Composable

0 commit comments

Comments
 (0)