diff --git a/composeApp/src/desktopMain/kotlin/org/ooni/probe/Main.kt b/composeApp/src/desktopMain/kotlin/org/ooni/probe/Main.kt index c09a44185..006e2183f 100644 --- a/composeApp/src/desktopMain/kotlin/org/ooni/probe/Main.kt +++ b/composeApp/src/desktopMain/kotlin/org/ooni/probe/Main.kt @@ -154,7 +154,7 @@ fun main(args: Array) { // Only show update UI on Mac and Windows platforms if (updateController.supportsUpdates()) { Item( - text = updateController.getMenuText(), + text = stringResource(updateController.getMenuText()), enabled = updateState != UpdateState.CHECKING_FOR_UPDATES, onClick = { updateController.checkNow() }, ) diff --git a/composeApp/src/desktopMain/kotlin/org/ooni/probe/update/DesktopUpdateController.kt b/composeApp/src/desktopMain/kotlin/org/ooni/probe/update/DesktopUpdateController.kt index ccd2b5a2c..a8798a94c 100644 --- a/composeApp/src/desktopMain/kotlin/org/ooni/probe/update/DesktopUpdateController.kt +++ b/composeApp/src/desktopMain/kotlin/org/ooni/probe/update/DesktopUpdateController.kt @@ -7,6 +7,11 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.launch +import ooniprobe.composeapp.generated.resources.Res +import ooniprobe.composeapp.generated.resources.Tray_Notification_Check_Updates +import ooniprobe.composeapp.generated.resources.Tray_Notification_Checking_Updates +import ooniprobe.composeapp.generated.resources.Tray_Notification_Updates_Available +import org.jetbrains.compose.resources.StringResource import org.ooni.probe.config.UpdateConfig import org.ooni.probe.dependencies import org.ooni.probe.shared.DesktopOS @@ -118,12 +123,11 @@ class DesktopUpdateController( updateManager.retryLastOperation() } - // TODO: add translations after macOS has been finalized - fun getMenuText(): String = + fun getMenuText(): StringResource = when (_state.value) { - UpdateState.CHECKING_FOR_UPDATES -> "Checking for Updates..." - UpdateState.UPDATE_AVAILABLE -> "Update Available!" - else -> "Check for Updates" + UpdateState.CHECKING_FOR_UPDATES -> Res.string.Tray_Notification_Checking_Updates + UpdateState.UPDATE_AVAILABLE -> Res.string.Tray_Notification_Updates_Available + else -> Res.string.Tray_Notification_Check_Updates } suspend fun cleanup() { diff --git a/composeApp/src/ooniMain/composeResources/values/strings-organization.xml b/composeApp/src/ooniMain/composeResources/values/strings-organization.xml index fb56968a0..d812f121e 100644 --- a/composeApp/src/ooniMain/composeResources/values/strings-organization.xml +++ b/composeApp/src/ooniMain/composeResources/values/strings-organization.xml @@ -53,4 +53,7 @@ Error opening donation page. Please go to %1$s You will be able to install this link again only from the original link sent by the creator. Measurements from this link will be deleted, but will be accessible from explorer. + Check for Updates + Update Available! + Checking for updates...