diff --git a/composeApp/src/androidInstrumentedTest/kotlin/org/ooni/probe/uitesting/DescriptorsTest.kt b/composeApp/src/androidInstrumentedTest/kotlin/org/ooni/probe/uitesting/DescriptorsTest.kt
index 8ebf9bf4..1122f81b 100644
--- a/composeApp/src/androidInstrumentedTest/kotlin/org/ooni/probe/uitesting/DescriptorsTest.kt
+++ b/composeApp/src/androidInstrumentedTest/kotlin/org/ooni/probe/uitesting/DescriptorsTest.kt
@@ -7,7 +7,6 @@ import androidx.compose.ui.test.assertIsNotDisplayed
import androidx.compose.ui.test.hasText
import androidx.compose.ui.test.isDisplayed
import androidx.compose.ui.test.junit4.createEmptyComposeRule
-import androidx.compose.ui.test.onAllNodesWithText
import androidx.compose.ui.test.onLast
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
diff --git a/composeApp/src/androidMain/kotlin/org/ooni/probe/background/DescriptorUpdateWorker.kt b/composeApp/src/androidMain/kotlin/org/ooni/probe/background/DescriptorUpdateWorker.kt
index 198bb07a..23b4825c 100644
--- a/composeApp/src/androidMain/kotlin/org/ooni/probe/background/DescriptorUpdateWorker.kt
+++ b/composeApp/src/androidMain/kotlin/org/ooni/probe/background/DescriptorUpdateWorker.kt
@@ -17,8 +17,8 @@ import kotlinx.coroutines.flow.first
import kotlinx.serialization.SerializationException
import kotlinx.serialization.encodeToString
import ooniprobe.composeapp.generated.resources.Dashboard_Running_Running
+import ooniprobe.composeapp.generated.resources.Notification_ChannelName
import ooniprobe.composeapp.generated.resources.Res
-import ooniprobe.composeapp.generated.resources.notification_channel_name
import org.jetbrains.compose.resources.getString
import org.ooni.probe.AndroidApplication
import org.ooni.probe.R
@@ -79,7 +79,7 @@ class DescriptorUpdateWorker(
notificationManager.createNotificationChannel(
NotificationChannel(
NOTIFICATION_CHANNEL_ID,
- getString(Res.string.notification_channel_name),
+ getString(Res.string.Notification_ChannelName),
NotificationManager.IMPORTANCE_DEFAULT,
),
)
diff --git a/composeApp/src/androidMain/kotlin/org/ooni/probe/background/RunWorker.kt b/composeApp/src/androidMain/kotlin/org/ooni/probe/background/RunWorker.kt
index becd5f52..2223fed2 100644
--- a/composeApp/src/androidMain/kotlin/org/ooni/probe/background/RunWorker.kt
+++ b/composeApp/src/androidMain/kotlin/org/ooni/probe/background/RunWorker.kt
@@ -22,10 +22,10 @@ import kotlinx.serialization.encodeToString
import ooniprobe.composeapp.generated.resources.Dashboard_Running_Running
import ooniprobe.composeapp.generated.resources.Dashboard_Running_Stopping_Notice
import ooniprobe.composeapp.generated.resources.Dashboard_Running_Stopping_Title
+import ooniprobe.composeapp.generated.resources.Notification_ChannelName
import ooniprobe.composeapp.generated.resources.Notification_StopTest
import ooniprobe.composeapp.generated.resources.Res
-import ooniprobe.composeapp.generated.resources.UploadingMissingResults
-import ooniprobe.composeapp.generated.resources.notification_channel_name
+import ooniprobe.composeapp.generated.resources.Results_UploadingMissing
import org.jetbrains.compose.resources.getString
import org.ooni.probe.AndroidApplication
import org.ooni.probe.MainActivity
@@ -130,7 +130,7 @@ class RunWorker(
notificationManager.createNotificationChannel(
NotificationChannel(
NOTIFICATION_CHANNEL_ID,
- getString(Res.string.notification_channel_name),
+ getString(Res.string.Notification_ChannelName),
NotificationManager.IMPORTANCE_LOW,
),
)
@@ -143,7 +143,7 @@ class RunWorker(
val progress = state.uploaded + state.failedToUpload + 1
setContentText(
getString(
- Res.string.UploadingMissingResults,
+ Res.string.Results_UploadingMissing,
"$progress/${state.total}",
),
)
diff --git a/composeApp/src/commonMain/composeResources/values/strings-common.xml b/composeApp/src/commonMain/composeResources/values/strings-common.xml
index 54499155..da685069 100644
--- a/composeApp/src/commonMain/composeResources/values/strings-common.xml
+++ b/composeApp/src/commonMain/composeResources/values/strings-common.xml
@@ -232,69 +232,71 @@
OONI Probe cannot run automatically without battery optimization. Do you want to try again?
- Last updated %1$s
- Back
- refresh
- Measurement
-
- - %1$d measurement
- - %1$d measurements
-
-
- - January
- - February
- - March
- - April
- - May
- - June
- - July
- - August
- - September
- - October
- - November
- - December
-
- %1$s ago
-
- - %1$d minute
- - %1$d minutes
-
-
- - %1$d hour
- - %1$d hours
-
- %1$dh
- %1$dm
- %1$ds
- Testing
- Manual Run
- Auto Run
- Collapse
- Expand
-
- - Run %1$d test
- - Run %1$d tests
-
- All Types
- All Sources
- VPN
- Go to Settings > General > VPN and disconnect from your VPN.
- Failed
- OK
- Anomaly
- Correct answer
- Incorrect answer
- Logs
- Share Logs
- Error sharing logs
- Filter Logs
- Only the last %1$d results are shown
- Skip after this amount of results failed to upload
+
+ Back
+ refresh
+ Collapse
+ Expand
+ %1$s ago
+ %1$d minute
+ %1$d minutes
+ %1$d hour
+ %1$d hours
+ %1$dh
+ %1$dm
+ %1$ds
+
+ January
+ February
+ March
+ April
+ May
+ June
+ July
+ August
+ September
+ October
+ November
+ December
+
+ Correct answer
+ Incorrect answer
+
+ Last updated %1$s
+
+ Run %1$d test
+ Run %1$d tests
+
Unsupported URL
+
+ Measurement
+
+ %1$d measurement
+ %1$d measurements
+
+ Failed
+ OK
+ Anomaly
+
+ All Types
+ All Sources
+ Only the last %1$d results are shown
+ Uploading missing results %1$s
+
+ Logs
+ Share Logs
+ Error sharing logs
+ Filter Logs
+ Go to Settings > General > VPN and disconnect from your VPN.
+ Skip after this amount of results failed to upload
Results are automatically uploaded to OONI explorer
Limit Websites test duration
Maximum Websites test duration
Tests will run every hour in the background
Only for manual runs
- Uploading missing results %1$s
+
+ Testing
+ Manual Run
+ Auto Run
+ VPN
diff --git a/composeApp/src/commonMain/composeResources/values/untraslatable.xml b/composeApp/src/commonMain/composeResources/values/untraslatable.xml
index d4ff1224..fea55471 100644
--- a/composeApp/src/commonMain/composeResources/values/untraslatable.xml
+++ b/composeApp/src/commonMain/composeResources/values/untraslatable.xml
@@ -2,4 +2,38 @@
bugs@openobservatory.org
[bug-report] OONI Probe %1$s
%1$s: %2$s
+
+
+ - @string/Common_Minutes_One
+ - @string/Common_Minutes_Other
+
+
+ - @string/Common_Hour_One
+ - @string/Common_Hour_Other
+
+
+
+ - @string/Dashboard_RunTests_RunButton_Label_One
+ - @string/Dashboard_RunTests_RunButton_Label_Other
+
+
+
+ - @string/Measurements_Count_One
+ - @string/Measurements_Count_Other
+
+
+
+ - @string/Common_Months_January
+ - @string/Common_Months_February
+ - @string/Common_Months_March
+ - @string/Common_Months_April
+ - @string/Common_Months_May
+ - @string/Common_Months_June
+ - @string/Common_Months_July
+ - @string/Common_Months_August
+ - @string/Common_Months_September
+ - @string/Common_Months_October
+ - @string/Common_Months_November
+ - @string/Common_Months_December
+
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/data/models/InstalledTestDescriptorModel.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/data/models/InstalledTestDescriptorModel.kt
index 9986f5ee..15d1a7a1 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/data/models/InstalledTestDescriptorModel.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/data/models/InstalledTestDescriptorModel.kt
@@ -2,24 +2,24 @@ package org.ooni.probe.data.models
import co.touchlab.kermit.Logger
import kotlinx.datetime.LocalDateTime
+import kotlinx.datetime.LocalDateTime.Companion.Format
+import kotlinx.datetime.format
+import kotlinx.datetime.format.MonthNames
+import kotlinx.datetime.format.char
import kotlinx.serialization.Serializable
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
+import ooniprobe.composeapp.generated.resources.Common_Months
import ooniprobe.composeapp.generated.resources.Dashboard_Runv2_Overview_Description
+import ooniprobe.composeapp.generated.resources.Dashboard_Runv2_Overview_LastUpdated
import ooniprobe.composeapp.generated.resources.Res
-import org.jetbrains.compose.resources.stringResource
-import kotlinx.datetime.LocalDateTime.Companion.Format
-import kotlinx.datetime.format
-import kotlinx.datetime.format.MonthNames
-import kotlinx.datetime.format.char
-import ooniprobe.composeapp.generated.resources.Dashboard_Runv2_Overview_LastUpdatd
-import ooniprobe.composeapp.generated.resources.months
import ooniprobe.composeapp.generated.resources.test_circumvention
import ooniprobe.composeapp.generated.resources.test_experimental
import ooniprobe.composeapp.generated.resources.test_instant_messaging
import ooniprobe.composeapp.generated.resources.test_performance
import ooniprobe.composeapp.generated.resources.test_websites
import org.jetbrains.compose.resources.stringArrayResource
+import org.jetbrains.compose.resources.stringResource
import org.ooni.probe.data.TestDescriptor
import org.ooni.probe.shared.InstalledDescriptorIcons
import org.ooni.probe.shared.hexToColor
@@ -65,7 +65,7 @@ fun InstalledTestDescriptorModel.toDescriptor(updateStatus: UpdateStatus = Updat
shortDescription = { shortDescriptionIntl?.getCurrent() ?: shortDescription },
description = { descriptionIntl?.getCurrent() ?: description },
metadata = {
- val monthNames = stringArrayResource(Res.array.months)
+ val monthNames = stringArrayResource(Res.array.Common_Months)
val formattedDate = { date: LocalDateTime? -> date?.format(dateTimeFormat(monthNames)) }
formattedDate(dateCreated)?.let { formattedDateCreated ->
stringResource(
@@ -73,7 +73,7 @@ fun InstalledTestDescriptorModel.toDescriptor(updateStatus: UpdateStatus = Updat
author.orEmpty(),
formattedDateCreated,
) + ". " + formattedDate(dateUpdated)?.let {
- stringResource(Res.string.Dashboard_Runv2_Overview_LastUpdatd, it)
+ stringResource(Res.string.Dashboard_Runv2_Overview_LastUpdated, it)
}
}
},
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/domain/GetSettings.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/domain/GetSettings.kt
index b73a1ce4..b03b1f9b 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/domain/GetSettings.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/domain/GetSettings.kt
@@ -26,6 +26,7 @@ import ooniprobe.composeapp.generated.resources.Settings_About_Label
import ooniprobe.composeapp.generated.resources.Settings_Advanced_DebugLogs
import ooniprobe.composeapp.generated.resources.Settings_Advanced_Label
import ooniprobe.composeapp.generated.resources.Settings_Advanced_RecentLogs
+import ooniprobe.composeapp.generated.resources.Settings_AutoTest_NotUploadedLimit
import ooniprobe.composeapp.generated.resources.Settings_AutomatedTesting_RunAutomatically
import ooniprobe.composeapp.generated.resources.Settings_AutomatedTesting_RunAutomatically_ChargingOnly
import ooniprobe.composeapp.generated.resources.Settings_AutomatedTesting_RunAutomatically_Description
@@ -49,7 +50,6 @@ import ooniprobe.composeapp.generated.resources.Settings_Websites_MaxRuntimeEnab
import ooniprobe.composeapp.generated.resources.Settings_Websites_MaxRuntimeEnabled_New
import ooniprobe.composeapp.generated.resources.Settings_Websites_MaxRuntime_New
import ooniprobe.composeapp.generated.resources.advanced
-import ooniprobe.composeapp.generated.resources.auto_test_not_uploaded_limit
import ooniprobe.composeapp.generated.resources.ic_settings
import ooniprobe.composeapp.generated.resources.notifications
import ooniprobe.composeapp.generated.resources.outline_info
@@ -179,7 +179,7 @@ class GetSettings(
indentation = 1,
),
SettingsItem(
- title = Res.string.auto_test_not_uploaded_limit,
+ title = Res.string.Settings_AutoTest_NotUploadedLimit,
key = SettingsKey.AUTOMATED_TESTING_NOT_UPLOADED_LIMIT,
type = PreferenceItemType.INT,
enabled = autoRunEnabled && uploadResultsEnabled,
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/domain/ShareLogFile.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/domain/ShareLogFile.kt
index 6835155b..b07833cb 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/domain/ShareLogFile.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/domain/ShareLogFile.kt
@@ -2,7 +2,7 @@ package org.ooni.probe.domain
import okio.Path
import ooniprobe.composeapp.generated.resources.Res
-import ooniprobe.composeapp.generated.resources.logs
+import ooniprobe.composeapp.generated.resources.Settings_Logs
import org.jetbrains.compose.resources.getString
import org.ooni.probe.data.models.PlatformAction
@@ -13,7 +13,7 @@ class ShareLogFile(
suspend operator fun invoke(): Boolean =
shareFile(
PlatformAction.FileSharing(
- title = getString(Res.string.logs),
+ title = getString(Res.string.Settings_Logs),
filePath = getAppLoggerFile(),
),
)
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/shared/ResourceExt.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/shared/ResourceExt.kt
new file mode 100644
index 00000000..5453e18b
--- /dev/null
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/shared/ResourceExt.kt
@@ -0,0 +1,67 @@
+package org.ooni.probe.shared
+
+import androidx.compose.runtime.Composable
+import ooniprobe.composeapp.generated.resources.Common_Hour_One
+import ooniprobe.composeapp.generated.resources.Common_Hour_Other
+import ooniprobe.composeapp.generated.resources.Common_Minutes_One
+import ooniprobe.composeapp.generated.resources.Common_Minutes_Other
+import ooniprobe.composeapp.generated.resources.Common_Months_April
+import ooniprobe.composeapp.generated.resources.Common_Months_August
+import ooniprobe.composeapp.generated.resources.Common_Months_December
+import ooniprobe.composeapp.generated.resources.Common_Months_February
+import ooniprobe.composeapp.generated.resources.Common_Months_January
+import ooniprobe.composeapp.generated.resources.Common_Months_July
+import ooniprobe.composeapp.generated.resources.Common_Months_June
+import ooniprobe.composeapp.generated.resources.Common_Months_March
+import ooniprobe.composeapp.generated.resources.Common_Months_May
+import ooniprobe.composeapp.generated.resources.Common_Months_November
+import ooniprobe.composeapp.generated.resources.Common_Months_October
+import ooniprobe.composeapp.generated.resources.Common_Months_September
+import ooniprobe.composeapp.generated.resources.Dashboard_RunTests_RunButton_Label_One
+import ooniprobe.composeapp.generated.resources.Dashboard_RunTests_RunButton_Label_Other
+import ooniprobe.composeapp.generated.resources.Measurements_Count_One
+import ooniprobe.composeapp.generated.resources.Measurements_Count_Other
+import ooniprobe.composeapp.generated.resources.Res
+import org.jetbrains.compose.resources.PluralStringResource
+import org.jetbrains.compose.resources.pluralStringResource
+import org.jetbrains.compose.resources.stringResource
+
+val stringMap = mapOf(
+ "@string/Common_Minutes_One" to Res.string.Common_Minutes_One,
+ "@string/Common_Minutes_Other" to Res.string.Common_Minutes_Other,
+ "@string/Common_Hour_One" to Res.string.Common_Hour_One,
+ "@string/Common_Hour_Other" to Res.string.Common_Hour_Other,
+ "@string/Dashboard_RunTests_RunButton_Label_One" to Res.string.Dashboard_RunTests_RunButton_Label_One,
+ "@string/Dashboard_RunTests_RunButton_Label_Other" to Res.string.Dashboard_RunTests_RunButton_Label_Other,
+ "@string/Measurements_Count_One" to Res.string.Measurements_Count_One,
+ "@string/Measurements_Count_Other" to Res.string.Measurements_Count_Other,
+)
+
+@Composable
+fun stringMonthArrayResource(): List {
+ return listOf(
+ stringResource(Res.string.Common_Months_January),
+ stringResource(Res.string.Common_Months_February),
+ stringResource(Res.string.Common_Months_March),
+ stringResource(Res.string.Common_Months_April),
+ stringResource(Res.string.Common_Months_May),
+ stringResource(Res.string.Common_Months_June),
+ stringResource(Res.string.Common_Months_July),
+ stringResource(Res.string.Common_Months_August),
+ stringResource(Res.string.Common_Months_September),
+ stringResource(Res.string.Common_Months_October),
+ stringResource(Res.string.Common_Months_November),
+ stringResource(Res.string.Common_Months_December),
+ )
+}
+
+@Composable
+fun pluralStringResourceItem(
+ resource: PluralStringResource,
+ quantity: Int,
+ vararg formatArgs: Any,
+): String {
+ return stringMap[pluralStringResource(resource, quantity, formatArgs)]?.let {
+ return stringResource(it, *formatArgs)
+ } ?: ""
+}
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/choosewebsites/ChooseWebsitesScreen.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/choosewebsites/ChooseWebsitesScreen.kt
index cad7e5a5..515aa9ea 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/choosewebsites/ChooseWebsitesScreen.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/choosewebsites/ChooseWebsitesScreen.kt
@@ -29,6 +29,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
+import ooniprobe.composeapp.generated.resources.Common_Back
import ooniprobe.composeapp.generated.resources.CustomWebsites_Fab_Text
import ooniprobe.composeapp.generated.resources.Modal_Cancel
import ooniprobe.composeapp.generated.resources.Modal_CustomURL_NotSaved
@@ -39,7 +40,6 @@ import ooniprobe.composeapp.generated.resources.Res
import ooniprobe.composeapp.generated.resources.Settings_Websites_CustomURL_Add
import ooniprobe.composeapp.generated.resources.Settings_Websites_CustomURL_Title
import ooniprobe.composeapp.generated.resources.Settings_Websites_CustomURL_URL
-import ooniprobe.composeapp.generated.resources.back
import ooniprobe.composeapp.generated.resources.ic_add
import ooniprobe.composeapp.generated.resources.ic_cancel
import ooniprobe.composeapp.generated.resources.ic_timer
@@ -63,7 +63,7 @@ fun ChooseWebsitesScreen(
IconButton(onClick = { onEvent(ChooseWebsitesViewModel.Event.BackClicked) }) {
Icon(
Icons.AutoMirrored.Filled.ArrowBack,
- contentDescription = stringResource(Res.string.back),
+ contentDescription = stringResource(Res.string.Common_Back),
)
}
},
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/dashboard/RunBackgroundStateSection.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/dashboard/RunBackgroundStateSection.kt
index b73e0075..80329586 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/dashboard/RunBackgroundStateSection.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/dashboard/RunBackgroundStateSection.kt
@@ -29,7 +29,7 @@ import ooniprobe.composeapp.generated.resources.Dashboard_Running_Stopping_Notic
import ooniprobe.composeapp.generated.resources.Dashboard_Running_Stopping_Title
import ooniprobe.composeapp.generated.resources.OONIRun_Run
import ooniprobe.composeapp.generated.resources.Res
-import ooniprobe.composeapp.generated.resources.UploadingMissingResults
+import ooniprobe.composeapp.generated.resources.Results_UploadingMissing
import ooniprobe.composeapp.generated.resources.ic_timer
import org.jetbrains.compose.resources.painterResource
import org.jetbrains.compose.resources.stringResource
@@ -104,7 +104,7 @@ fun RunBackgroundStateSection(
val progress = uploadState.uploaded + uploadState.failedToUpload + 1
Text(
text = stringResource(
- Res.string.UploadingMissingResults,
+ Res.string.Results_UploadingMissing,
"$progress/${uploadState.total}",
),
style = MaterialTheme.typography.bodyLarge,
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/descriptor/DescriptorScreen.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/descriptor/DescriptorScreen.kt
index 3c6e5c08..2e214413 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/descriptor/DescriptorScreen.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/descriptor/DescriptorScreen.kt
@@ -39,13 +39,13 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import ooniprobe.composeapp.generated.resources.AddDescriptor_AutoRun
import ooniprobe.composeapp.generated.resources.AddDescriptor_Settings
+import ooniprobe.composeapp.generated.resources.Common_Back
import ooniprobe.composeapp.generated.resources.Dashboard_Overview_ChooseWebsites
import ooniprobe.composeapp.generated.resources.Dashboard_Overview_Estimated
import ooniprobe.composeapp.generated.resources.Dashboard_Overview_LastRun_Never
import ooniprobe.composeapp.generated.resources.Dashboard_Overview_LatestTest
import ooniprobe.composeapp.generated.resources.Dashboard_Runv2_Overview_ReviewUpdates
import ooniprobe.composeapp.generated.resources.Res
-import ooniprobe.composeapp.generated.resources.back
import ooniprobe.composeapp.generated.resources.ooni_empty_state
import org.jetbrains.compose.resources.painterResource
import org.jetbrains.compose.resources.stringResource
@@ -91,7 +91,7 @@ fun DescriptorScreen(
IconButton(onClick = { onEvent(DescriptorViewModel.Event.BackClicked) }) {
Icon(
Icons.AutoMirrored.Filled.ArrowBack,
- contentDescription = stringResource(Res.string.back),
+ contentDescription = stringResource(Res.string.Common_Back),
)
}
},
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/log/LogScreen.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/log/LogScreen.kt
index 8599de96..ee6588eb 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/log/LogScreen.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/log/LogScreen.kt
@@ -34,14 +34,14 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import co.touchlab.kermit.Severity
+import ooniprobe.composeapp.generated.resources.Common_Back
import ooniprobe.composeapp.generated.resources.Res
+import ooniprobe.composeapp.generated.resources.Settings_FilterLogs
+import ooniprobe.composeapp.generated.resources.Settings_Logs
+import ooniprobe.composeapp.generated.resources.Settings_ShareLogs
+import ooniprobe.composeapp.generated.resources.Settings_ShareLogs_Error
import ooniprobe.composeapp.generated.resources.Settings_Storage_Delete
-import ooniprobe.composeapp.generated.resources.back
-import ooniprobe.composeapp.generated.resources.filter_logs
import ooniprobe.composeapp.generated.resources.ic_delete_all
-import ooniprobe.composeapp.generated.resources.logs
-import ooniprobe.composeapp.generated.resources.share_logs
-import ooniprobe.composeapp.generated.resources.share_logs_error
import org.jetbrains.compose.resources.getString
import org.jetbrains.compose.resources.painterResource
import org.jetbrains.compose.resources.stringResource
@@ -57,12 +57,12 @@ fun LogScreen(
) {
Column(Modifier.background(MaterialTheme.colorScheme.background)) {
TopBar(
- title = { Text(stringResource(Res.string.logs)) },
+ title = { Text(stringResource(Res.string.Settings_Logs)) },
navigationIcon = {
IconButton(onClick = { onEvent(LogViewModel.Event.BackClicked) }) {
Icon(
Icons.AutoMirrored.Filled.ArrowBack,
- contentDescription = stringResource(Res.string.back),
+ contentDescription = stringResource(Res.string.Common_Back),
)
}
},
@@ -76,7 +76,7 @@ fun LogScreen(
IconButton(onClick = { onEvent(LogViewModel.Event.ShareClicked) }) {
Icon(
Icons.Default.Share,
- contentDescription = stringResource(Res.string.share_logs),
+ contentDescription = stringResource(Res.string.Settings_ShareLogs),
)
}
},
@@ -90,7 +90,7 @@ fun LogScreen(
.padding(bottom = 8.dp),
) {
Text(
- stringResource(Res.string.filter_logs),
+ stringResource(Res.string.Settings_FilterLogs),
modifier = Modifier.weight(2f),
)
SeverityFilter(
@@ -129,7 +129,7 @@ fun LogScreen(
snackbarHostState.showSnackbar(
getString(
when (error) {
- LogViewModel.Error.Share -> Res.string.share_logs_error
+ LogViewModel.Error.Share -> Res.string.Settings_ShareLogs_Error
},
),
)
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/measurement/MeasurementScreen.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/measurement/MeasurementScreen.kt
index ac4e6bed..2e5e8310 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/measurement/MeasurementScreen.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/measurement/MeasurementScreen.kt
@@ -28,10 +28,10 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
+import ooniprobe.composeapp.generated.resources.Common_Back
+import ooniprobe.composeapp.generated.resources.Common_Refresh
+import ooniprobe.composeapp.generated.resources.Measurement_Title
import ooniprobe.composeapp.generated.resources.Res
-import ooniprobe.composeapp.generated.resources.back
-import ooniprobe.composeapp.generated.resources.measurement
-import ooniprobe.composeapp.generated.resources.refresh
import org.intellij.markdown.html.urlEncode
import org.jetbrains.compose.resources.stringResource
import org.ooni.probe.config.OrganizationConfig
@@ -56,13 +56,13 @@ fun MeasurementScreen(
Box {
TopBar(
title = {
- Text(stringResource(Res.string.measurement))
+ Text(stringResource(Res.string.Measurement_Title))
},
navigationIcon = {
IconButton(onClick = { onBack() }) {
Icon(
Icons.AutoMirrored.Filled.ArrowBack,
- contentDescription = stringResource(Res.string.back),
+ contentDescription = stringResource(Res.string.Common_Back),
)
}
},
@@ -93,7 +93,7 @@ fun MeasurementScreen(
) {
Icon(
Icons.Default.Refresh,
- contentDescription = stringResource(Res.string.refresh),
+ contentDescription = stringResource(Res.string.Common_Refresh),
)
}
}
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/onboarding/OnboardingQuiz.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/onboarding/OnboardingQuiz.kt
index 76247808..e822a1c7 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/onboarding/OnboardingQuiz.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/onboarding/OnboardingQuiz.kt
@@ -39,9 +39,9 @@ import ooniprobe.composeapp.generated.resources.Onboarding_PopQuiz_Title
import ooniprobe.composeapp.generated.resources.Onboarding_PopQuiz_True
import ooniprobe.composeapp.generated.resources.Onboarding_PopQuiz_Wrong_Button_Back
import ooniprobe.composeapp.generated.resources.Onboarding_PopQuiz_Wrong_Button_Continue
+import ooniprobe.composeapp.generated.resources.Onboarding_QuizAnswer_Correct
+import ooniprobe.composeapp.generated.resources.Onboarding_QuizAnswer_Incorrect
import ooniprobe.composeapp.generated.resources.Res
-import ooniprobe.composeapp.generated.resources.quiz_answer_correct
-import ooniprobe.composeapp.generated.resources.quiz_answer_incorrect
import org.jetbrains.compose.resources.StringResource
import org.jetbrains.compose.resources.stringResource
import org.ooni.probe.data.models.Animation
@@ -200,9 +200,9 @@ private fun ResultAnimation(
animation = if (isCorrect) Animation.QuizCorrect else Animation.QuizIncorrect,
contentDescription = stringResource(
if (isCorrect) {
- Res.string.quiz_answer_correct
+ Res.string.Onboarding_QuizAnswer_Correct
} else {
- Res.string.quiz_answer_incorrect
+ Res.string.Onboarding_QuizAnswer_Incorrect
},
),
restartOnPlay = false,
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/result/ResultMeasurementCell.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/result/ResultMeasurementCell.kt
index 70a09210..829d52ab 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/result/ResultMeasurementCell.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/result/ResultMeasurementCell.kt
@@ -17,6 +17,9 @@ import androidx.compose.ui.draw.alpha
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
+import ooniprobe.composeapp.generated.resources.Measurements_Anomaly
+import ooniprobe.composeapp.generated.resources.Measurements_Failed
+import ooniprobe.composeapp.generated.resources.Measurements_Ok
import ooniprobe.composeapp.generated.resources.Modal_UploadFailed_Title
import ooniprobe.composeapp.generated.resources.Res
import ooniprobe.composeapp.generated.resources.Snackbar_ResultsNotUploaded_Text
@@ -24,9 +27,6 @@ import ooniprobe.composeapp.generated.resources.ic_cloud_off
import ooniprobe.composeapp.generated.resources.ic_measurement_anomaly
import ooniprobe.composeapp.generated.resources.ic_measurement_failed
import ooniprobe.composeapp.generated.resources.ic_measurement_ok
-import ooniprobe.composeapp.generated.resources.measurement_anomaly
-import ooniprobe.composeapp.generated.resources.measurement_failed
-import ooniprobe.composeapp.generated.resources.measurement_ok
import org.jetbrains.compose.resources.painterResource
import org.jetbrains.compose.resources.stringResource
import org.ooni.engine.models.TestType
@@ -111,9 +111,9 @@ fun ResultMeasurementCell(
),
contentDescription = stringResource(
when {
- isFailed -> Res.string.measurement_failed
- measurement.isAnomaly -> Res.string.measurement_anomaly
- else -> Res.string.measurement_ok
+ isFailed -> Res.string.Measurements_Failed
+ measurement.isAnomaly -> Res.string.Measurements_Anomaly
+ else -> Res.string.Measurements_Ok
},
),
tint = Color.Unspecified,
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/result/ResultScreen.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/result/ResultScreen.kt
index 3127dc6b..3d2429a4 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/result/ResultScreen.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/result/ResultScreen.kt
@@ -41,10 +41,12 @@ import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.clip
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
+import ooniprobe.composeapp.generated.resources.Common_Back
import ooniprobe.composeapp.generated.resources.Modal_Cancel
import ooniprobe.composeapp.generated.resources.Modal_ReRun_Title
import ooniprobe.composeapp.generated.resources.Modal_ReRun_Websites_Run
import ooniprobe.composeapp.generated.resources.Modal_ReRun_Websites_Title
+import ooniprobe.composeapp.generated.resources.NetworkType_Vpn
import ooniprobe.composeapp.generated.resources.Res
import ooniprobe.composeapp.generated.resources.TestResults_NotAvailable
import ooniprobe.composeapp.generated.resources.TestResults_Overview_Hero_DataUsage
@@ -58,12 +60,10 @@ import ooniprobe.composeapp.generated.resources.TestResults_Summary_Hero_Runtime
import ooniprobe.composeapp.generated.resources.TestResults_Summary_Hero_WiFi
import ooniprobe.composeapp.generated.resources.TestResults_Summary_Performance_Hero_Download
import ooniprobe.composeapp.generated.resources.TestResults_Summary_Performance_Hero_Upload
-import ooniprobe.composeapp.generated.resources.back
import ooniprobe.composeapp.generated.resources.ic_download
import ooniprobe.composeapp.generated.resources.ic_replay
import ooniprobe.composeapp.generated.resources.ic_upload
import ooniprobe.composeapp.generated.resources.ooni_bw
-import ooniprobe.composeapp.generated.resources.vpn
import org.jetbrains.compose.resources.painterResource
import org.jetbrains.compose.resources.stringResource
import org.ooni.engine.models.NetworkType
@@ -94,7 +94,7 @@ fun ResultScreen(
IconButton(onClick = { onEvent(ResultViewModel.Event.BackClicked) }) {
Icon(
Icons.AutoMirrored.Filled.ArrowBack,
- contentDescription = stringResource(Res.string.back),
+ contentDescription = stringResource(Res.string.Common_Back),
)
}
},
@@ -316,7 +316,7 @@ private fun NetworkType.label(): String =
when (this) {
NetworkType.Mobile -> Res.string.TestResults_Summary_Hero_Mobile
NetworkType.NoInternet -> Res.string.TestResults_Summary_Hero_NoInternet
- NetworkType.VPN -> Res.string.vpn
+ NetworkType.VPN -> Res.string.NetworkType_Vpn
NetworkType.Wifi -> Res.string.TestResults_Summary_Hero_WiFi
is NetworkType.Unknown -> Res.string.TestResults_NotAvailable
},
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/results/ResultCell.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/results/ResultCell.kt
index 3ae7627a..0ed90f10 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/results/ResultCell.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/results/ResultCell.kt
@@ -18,19 +18,19 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
+import ooniprobe.composeapp.generated.resources.Measurements_Count
import ooniprobe.composeapp.generated.resources.Modal_UploadFailed_Title
import ooniprobe.composeapp.generated.resources.Res
import ooniprobe.composeapp.generated.resources.Snackbar_ResultsNotUploaded_Text
+import ooniprobe.composeapp.generated.resources.TaskOrigin_AutoRun
+import ooniprobe.composeapp.generated.resources.TaskOrigin_Manual
import ooniprobe.composeapp.generated.resources.TestResults_UnknownASN
import ooniprobe.composeapp.generated.resources.ic_cloud_off
-import ooniprobe.composeapp.generated.resources.measurements_count
-import ooniprobe.composeapp.generated.resources.task_origin_auto_run
-import ooniprobe.composeapp.generated.resources.task_origin_manual
import org.jetbrains.compose.resources.painterResource
-import org.jetbrains.compose.resources.pluralStringResource
import org.jetbrains.compose.resources.stringResource
import org.ooni.engine.models.TaskOrigin
import org.ooni.probe.data.models.ResultListItem
+import org.ooni.probe.shared.pluralStringResourceItem
import org.ooni.probe.ui.dashboard.TestDescriptorLabel
import org.ooni.probe.ui.shared.relativeDateTime
@@ -106,8 +106,8 @@ fun ResultCell(
Text(
stringResource(
when (item.result.taskOrigin) {
- TaskOrigin.AutoRun -> Res.string.task_origin_auto_run
- TaskOrigin.OoniRun -> Res.string.task_origin_manual
+ TaskOrigin.AutoRun -> Res.string.TaskOrigin_AutoRun
+ TaskOrigin.OoniRun -> Res.string.TaskOrigin_Manual
},
),
style = MaterialTheme.typography.labelLarge,
@@ -115,8 +115,8 @@ fun ResultCell(
)
if (!hasError) {
Text(
- pluralStringResource(
- Res.plurals.measurements_count,
+ pluralStringResourceItem(
+ Res.plurals.Measurements_Count,
item.measurementsCount.toInt(),
item.measurementsCount,
),
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/results/ResultFilterViews.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/results/ResultFilterViews.kt
index 6c9b0b88..611c2a25 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/results/ResultFilterViews.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/results/ResultFilterViews.kt
@@ -13,10 +13,10 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextOverflow
import ooniprobe.composeapp.generated.resources.Res
-import ooniprobe.composeapp.generated.resources.task_origin_all
-import ooniprobe.composeapp.generated.resources.task_origin_auto_run
-import ooniprobe.composeapp.generated.resources.task_origin_manual
-import ooniprobe.composeapp.generated.resources.test_type_all
+import ooniprobe.composeapp.generated.resources.Results_TaskOrigin_All
+import ooniprobe.composeapp.generated.resources.Results_TestType_All
+import ooniprobe.composeapp.generated.resources.TaskOrigin_AutoRun
+import ooniprobe.composeapp.generated.resources.TaskOrigin_Manual
import org.jetbrains.compose.resources.stringResource
import org.ooni.engine.models.TaskOrigin
import org.ooni.probe.data.models.Descriptor
@@ -108,16 +108,16 @@ fun OriginFilter(
@Composable
private fun ResultFilter.Type.label() =
when (this) {
- ResultFilter.Type.All -> stringResource(Res.string.test_type_all)
+ ResultFilter.Type.All -> stringResource(Res.string.Results_TestType_All)
is ResultFilter.Type.One -> value.title()
}
@Composable
private fun ResultFilter.Type.name() =
when (this) {
- ResultFilter.Type.All -> stringResource(Res.string.task_origin_all)
+ ResultFilter.Type.All -> stringResource(Res.string.Results_TaskOrigin_All)
is ResultFilter.Type.One -> when (value) {
- TaskOrigin.AutoRun -> stringResource(Res.string.task_origin_auto_run)
- TaskOrigin.OoniRun -> stringResource(Res.string.task_origin_manual)
+ TaskOrigin.AutoRun -> stringResource(Res.string.TaskOrigin_AutoRun)
+ TaskOrigin.OoniRun -> stringResource(Res.string.TaskOrigin_Manual)
}
}
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/results/ResultsScreen.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/results/ResultsScreen.kt
index ebe9d25a..3053b1ea 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/results/ResultsScreen.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/results/ResultsScreen.kt
@@ -46,6 +46,7 @@ import ooniprobe.composeapp.generated.resources.Modal_Cancel
import ooniprobe.composeapp.generated.resources.Modal_Delete
import ooniprobe.composeapp.generated.resources.Modal_DoYouWantToDeleteAllTests
import ooniprobe.composeapp.generated.resources.Res
+import ooniprobe.composeapp.generated.resources.Results_LimitedNotice
import ooniprobe.composeapp.generated.resources.Snackbar_ResultsSomeNotUploaded_Text
import ooniprobe.composeapp.generated.resources.Snackbar_ResultsSomeNotUploaded_UploadAll
import ooniprobe.composeapp.generated.resources.TestResults_Overview_FilterTests
@@ -59,12 +60,10 @@ import ooniprobe.composeapp.generated.resources.TestResults_Summary_Performance_
import ooniprobe.composeapp.generated.resources.ic_delete_all
import ooniprobe.composeapp.generated.resources.ic_download
import ooniprobe.composeapp.generated.resources.ic_upload
-import ooniprobe.composeapp.generated.resources.months
import ooniprobe.composeapp.generated.resources.ooni_empty_state
-import ooniprobe.composeapp.generated.resources.results_limited_notice
import org.jetbrains.compose.resources.painterResource
-import org.jetbrains.compose.resources.stringArrayResource
import org.jetbrains.compose.resources.stringResource
+import org.ooni.probe.shared.stringMonthArrayResource
import org.ooni.probe.ui.shared.TopBar
import org.ooni.probe.ui.shared.formatDataUsage
import org.ooni.probe.ui.shared.isHeightCompact
@@ -151,7 +150,7 @@ fun ResultsScreen(
item("limited") {
Text(
text = stringResource(
- Res.string.results_limited_notice,
+ Res.string.Results_LimitedNotice,
state.filter.limit,
),
style = MaterialTheme.typography.labelLarge,
@@ -316,7 +315,7 @@ private fun Summary(summary: ResultsViewModel.Summary?) {
@Composable
private fun ResultDateHeader(date: LocalDate) {
- val monthNames = stringArrayResource(Res.array.months)
+ val monthNames = stringMonthArrayResource()
Text(
date.format(
Format {
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/run/RunScreen.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/run/RunScreen.kt
index 336d359c..054ba640 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/run/RunScreen.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/run/RunScreen.kt
@@ -43,6 +43,9 @@ import androidx.compose.ui.platform.testTag
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.state.ToggleableState
import androidx.compose.ui.unit.dp
+import ooniprobe.composeapp.generated.resources.Common_Back
+import ooniprobe.composeapp.generated.resources.Common_Collapse
+import ooniprobe.composeapp.generated.resources.Common_Expand
import ooniprobe.composeapp.generated.resources.Dashboard_RunTests_Description
import ooniprobe.composeapp.generated.resources.Dashboard_RunTests_RunButton_Label
import ooniprobe.composeapp.generated.resources.Dashboard_RunTests_SelectAll
@@ -55,21 +58,18 @@ import ooniprobe.composeapp.generated.resources.Modal_DisableVPN_Title
import ooniprobe.composeapp.generated.resources.Modal_OK
import ooniprobe.composeapp.generated.resources.Modal_RunAnyway
import ooniprobe.composeapp.generated.resources.Res
-import ooniprobe.composeapp.generated.resources.back
-import ooniprobe.composeapp.generated.resources.collapse
-import ooniprobe.composeapp.generated.resources.disable_vpn_instructions
-import ooniprobe.composeapp.generated.resources.expand
+import ooniprobe.composeapp.generated.resources.Settings_DisableVpnInstructions
import ooniprobe.composeapp.generated.resources.ic_keyboard_arrow_down
import ooniprobe.composeapp.generated.resources.ic_keyboard_arrow_up
import ooniprobe.composeapp.generated.resources.ic_timer
import org.jetbrains.compose.resources.painterResource
-import org.jetbrains.compose.resources.pluralStringResource
import org.jetbrains.compose.resources.stringResource
import org.ooni.engine.models.TestType
import org.ooni.probe.config.OrganizationConfig
import org.ooni.probe.config.TestDisplayMode
import org.ooni.probe.data.models.Descriptor
import org.ooni.probe.data.models.NetTest
+import org.ooni.probe.shared.pluralStringResourceItem
import org.ooni.probe.ui.dashboard.TestDescriptorLabel
import org.ooni.probe.ui.dashboard.TestDescriptorSection
import org.ooni.probe.ui.shared.ParentSelectableItem
@@ -91,7 +91,7 @@ fun RunScreen(
IconButton(onClick = { onEvent(RunViewModel.Event.BackClicked) }) {
Icon(
Icons.AutoMirrored.Filled.ArrowBack,
- contentDescription = stringResource(Res.string.back),
+ contentDescription = stringResource(Res.string.Common_Back),
)
}
},
@@ -189,7 +189,7 @@ fun RunScreen(
.padding(WindowInsets.navigationBars.asPaddingValues()),
) {
Text(
- text = pluralStringResource(
+ text = pluralStringResourceItem(
Res.plurals.Dashboard_RunTests_RunButton_Label,
selectedTestsCount,
selectedTestsCount,
@@ -291,9 +291,9 @@ private fun DescriptorItem(
),
contentDescription = stringResource(
if (descriptorItem.isExpanded) {
- Res.string.collapse
+ Res.string.Common_Collapse
} else {
- Res.string.expand
+ Res.string.Common_Expand
},
),
)
@@ -380,7 +380,7 @@ private fun DisableVpnInstructionsDialog(onDismiss: () -> Unit) {
AlertDialog(
onDismissRequest = { onDismiss() },
title = { Text(stringResource(Res.string.Modal_DisableVPN)) },
- text = { Text(stringResource(Res.string.disable_vpn_instructions)) },
+ text = { Text(stringResource(Res.string.Settings_DisableVpnInstructions)) },
confirmButton = {
TextButton(onClick = { onDismiss() }) {
Text(stringResource(Res.string.Modal_OK))
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/running/RunningScreen.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/running/RunningScreen.kt
index be11f3ca..4f6298cc 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/running/RunningScreen.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/running/RunningScreen.kt
@@ -34,6 +34,7 @@ import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
+import ooniprobe.composeapp.generated.resources.Common_Back
import ooniprobe.composeapp.generated.resources.Dashboard_Running_EstimatedTimeLeft
import ooniprobe.composeapp.generated.resources.Dashboard_Running_ProxyInUse
import ooniprobe.composeapp.generated.resources.Dashboard_Running_Running
@@ -41,7 +42,6 @@ import ooniprobe.composeapp.generated.resources.Dashboard_Running_Stopping_Notic
import ooniprobe.composeapp.generated.resources.Dashboard_Running_Stopping_Title
import ooniprobe.composeapp.generated.resources.Notification_StopTest
import ooniprobe.composeapp.generated.resources.Res
-import ooniprobe.composeapp.generated.resources.back
import ooniprobe.composeapp.generated.resources.ooni_empty_state
import ooniprobe.composeapp.generated.resources.test_circumvention
import org.jetbrains.compose.resources.painterResource
@@ -73,7 +73,7 @@ fun RunningScreen(
IconButton(onClick = { onEvent(RunningViewModel.Event.BackClicked) }) {
Icon(
Icons.AutoMirrored.Filled.ArrowBack,
- contentDescription = stringResource(Res.string.back),
+ contentDescription = stringResource(Res.string.Common_Back),
)
}
},
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/settings/about/AboutScreen.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/settings/about/AboutScreen.kt
index c26cd225..0d367611 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/settings/about/AboutScreen.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/settings/about/AboutScreen.kt
@@ -26,9 +26,9 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
+import ooniprobe.composeapp.generated.resources.Common_Back
import ooniprobe.composeapp.generated.resources.Res
import ooniprobe.composeapp.generated.resources.Settings_About_Content_Paragraph
-import ooniprobe.composeapp.generated.resources.back
import ooniprobe.composeapp.generated.resources.version
import org.jetbrains.compose.resources.stringResource
import org.ooni.probe.ui.shared.MarkdownViewer
@@ -53,7 +53,7 @@ fun AboutScreen(
IconButton(onClick = { onEvent(AboutViewModel.Event.BackClicked) }) {
Icon(
Icons.AutoMirrored.Filled.ArrowBack,
- contentDescription = stringResource(Res.string.back),
+ contentDescription = stringResource(Res.string.Common_Back),
)
}
},
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/settings/category/SettingsCategoryScreen.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/settings/category/SettingsCategoryScreen.kt
index f685ef84..6d04f733 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/settings/category/SettingsCategoryScreen.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/settings/category/SettingsCategoryScreen.kt
@@ -38,10 +38,10 @@ import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
+import ooniprobe.composeapp.generated.resources.Common_Back
import ooniprobe.composeapp.generated.resources.Modal_Cancel
import ooniprobe.composeapp.generated.resources.Modal_OK
import ooniprobe.composeapp.generated.resources.Res
-import ooniprobe.composeapp.generated.resources.back
import org.jetbrains.compose.resources.DrawableResource
import org.jetbrains.compose.resources.StringResource
import org.jetbrains.compose.resources.painterResource
@@ -65,7 +65,7 @@ fun SettingsCategoryScreen(
IconButton(onClick = { onEvent(SettingsCategoryViewModel.Event.BackClicked) }) {
Icon(
Icons.AutoMirrored.Filled.ArrowBack,
- contentDescription = stringResource(Res.string.back),
+ contentDescription = stringResource(Res.string.Common_Back),
)
}
},
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/settings/proxy/ProxyScreen.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/settings/proxy/ProxyScreen.kt
index ea271a8a..1e496573 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/settings/proxy/ProxyScreen.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/settings/proxy/ProxyScreen.kt
@@ -35,12 +35,12 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
+import ooniprobe.composeapp.generated.resources.Common_Back
import ooniprobe.composeapp.generated.resources.Res
import ooniprobe.composeapp.generated.resources.Settings_Proxy_Custom_Hostname
import ooniprobe.composeapp.generated.resources.Settings_Proxy_Custom_Port
import ooniprobe.composeapp.generated.resources.Settings_Proxy_Custom_Protocol
import ooniprobe.composeapp.generated.resources.Settings_Proxy_Enabled
-import ooniprobe.composeapp.generated.resources.back
import org.jetbrains.compose.resources.stringResource
import org.ooni.probe.data.models.ProxyProtocol
import org.ooni.probe.data.models.ProxyType
@@ -62,7 +62,7 @@ fun ProxyScreen(
}) {
Icon(
Icons.AutoMirrored.Filled.ArrowBack,
- contentDescription = stringResource(Res.string.back),
+ contentDescription = stringResource(Res.string.Common_Back),
)
}
},
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/shared/DateFormats.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/shared/DateFormats.kt
index 740e1db0..e37f1172 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/shared/DateFormats.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/shared/DateFormats.kt
@@ -8,15 +8,15 @@ import kotlinx.datetime.TimeZone
import kotlinx.datetime.format
import kotlinx.datetime.format.char
import kotlinx.datetime.toInstant
+import ooniprobe.composeapp.generated.resources.Common_Ago
+import ooniprobe.composeapp.generated.resources.Common_Hours
+import ooniprobe.composeapp.generated.resources.Common_Hours_Abbreviated
+import ooniprobe.composeapp.generated.resources.Common_Minutes
+import ooniprobe.composeapp.generated.resources.Common_Minutes_Abbreviated
+import ooniprobe.composeapp.generated.resources.Common_Seconds_Abbreviated
import ooniprobe.composeapp.generated.resources.Res
-import ooniprobe.composeapp.generated.resources.ago
-import ooniprobe.composeapp.generated.resources.hours
-import ooniprobe.composeapp.generated.resources.hours_abbreviated
-import ooniprobe.composeapp.generated.resources.minutes
-import ooniprobe.composeapp.generated.resources.minutes_abbreviated
-import ooniprobe.composeapp.generated.resources.seconds_abbreviated
-import org.jetbrains.compose.resources.pluralStringResource
import org.jetbrains.compose.resources.stringResource
+import org.ooni.probe.shared.pluralStringResourceItem
import org.ooni.probe.shared.today
import kotlin.time.Duration
@@ -44,12 +44,12 @@ fun LocalDateTime.relativeDateTime(): String =
val diff = (Clock.System.now() - toInstant(TimeZone.currentSystemDefault()))
val diffString = diff.toComponents { hours, minutes, _, _ ->
if (hours > 0) {
- pluralStringResource(Res.plurals.hours, hours.toInt(), hours.toInt())
+ pluralStringResourceItem(Res.plurals.Common_Hours, hours.toInt(), hours.toInt())
} else {
- pluralStringResource(Res.plurals.minutes, minutes, minutes)
+ pluralStringResourceItem(Res.plurals.Common_Minutes, minutes, minutes)
}
}
- stringResource(Res.string.ago, diffString)
+ stringResource(Res.string.Common_Ago, diffString)
} else {
longFormat()
}
@@ -61,9 +61,23 @@ fun LocalDateTime.logFormat(): String = format(logDateTimeFormat)
@Composable
fun Duration.shortFormat(): String =
toComponents { hours, minutes, seconds, _ ->
- (if (hours > 0) stringResource(Res.string.hours_abbreviated, hours.toInt()) else "") +
- " " +
- (if (minutes > 0) stringResource(Res.string.minutes_abbreviated, minutes) else "") +
- " " +
- (if (seconds > 0) stringResource(Res.string.seconds_abbreviated, seconds) else "")
+ (
+ if (hours > 0) {
+ stringResource(Res.string.Common_Hours_Abbreviated, hours.toInt())
+ } else {
+ ""
+ }
+ ) + " " + (
+ if (minutes > 0) {
+ stringResource(Res.string.Common_Minutes_Abbreviated, minutes)
+ } else {
+ ""
+ }
+ ) + " " + (
+ if (seconds > 0) {
+ stringResource(Res.string.Common_Seconds_Abbreviated, seconds)
+ } else {
+ ""
+ }
+ )
}.trimStart()
diff --git a/composeApp/src/commonTest/kotlin/org/ooni/probe/background/RunBackgroundTaskTest.kt b/composeApp/src/commonTest/kotlin/org/ooni/probe/background/RunBackgroundTaskTest.kt
index c43dfc99..d77295fa 100644
--- a/composeApp/src/commonTest/kotlin/org/ooni/probe/background/RunBackgroundTaskTest.kt
+++ b/composeApp/src/commonTest/kotlin/org/ooni/probe/background/RunBackgroundTaskTest.kt
@@ -57,7 +57,7 @@ class RunBackgroundTaskTest {
)
subject(
- RunSpecification(
+ RunSpecification.Full(
tests = emptyList(),
taskOrigin = TaskOrigin.OoniRun,
isRerun = false,
@@ -72,8 +72,8 @@ class RunBackgroundTaskTest {
uploadMissingMeasurements: (ResultModel.Id?) -> Flow = { emptyFlow() },
checkSkipAutoRunNotUploadedLimit: () -> Flow = { flowOf(false) },
getNetworkType: () -> NetworkType = { NetworkType.Wifi },
- getAutoRunSpecification: suspend () -> RunSpecification = {
- RunSpecification(
+ getAutoRunSpecification: suspend () -> RunSpecification.Full = {
+ RunSpecification.Full(
tests = emptyList(),
taskOrigin = TaskOrigin.AutoRun,
isRerun = false,