i18n: extract hardcoded strings in backup, shop, globalesim, securemail
- Commit
c56e83cd4aab3f1f9948986216aea7339f337184- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-20 22:00 UTC (15 days ago)
- Parents
204f5c1
The reference app backup had 33 hardcoded UI literals; shop 54 call sites; globalesim and securemail had essentially no strings.xml (45 and 86 resources now). All user-visible text in their ui/ trees goes through resources, reusing library/ui strings where the wording already exists. Format placeholders and plurals follow the existing conventions; remaining out-of-scope literals (ViewModel messages, navigation titles) are counted and reported, not hidden. Verified: compile for all four modules plus backup's updated config test compilation.
Diff
backup/src/main/java/com/vayunmathur/backup/ui/DashboardScreen.kt
diff --git a/backup/src/main/java/com/vayunmathur/backup/ui/DashboardScreen.kt b/backup/src/main/java/com/vayunmathur/backup/ui/DashboardScreen.ktindex 8871b4e216..ab477c1422 100644--- a/backup/src/main/java/com/vayunmathur/backup/ui/DashboardScreen.kt+++ b/backup/src/main/java/com/vayunmathur/backup/ui/DashboardScreen.kt@@ -11,7 +11,10 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp+import com.vayunmathur.backup.R import com.vayunmathur.backup.platform.BackupUiState import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.Button@@ -37,7 +40,7 @@ fun DashboardScreen( onBackupNow: () -> Unit, onRestoreNow: () -> Unit, ) {- AppScaffold(title = "Backup") { padding ->+ AppScaffold(title = stringResource(R.string.app_name)) { padding -> // Letterboxed on expanded windows so the form keeps a readable measure. DesktopMaxWidthContainer(Modifier.padding(padding)) { Column(@@ -53,17 +56,20 @@ fun DashboardScreen( Row { CircularProgressIndicator() Spacer(Modifier.width(12.dp))- Text("Working…")+ Text(stringResource(R.string.dashboard_working)) } } Card(modifier = Modifier.fillMaxWidth()) { Column(Modifier.padding(16.dp).fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(4.dp)) {- Text("Status", style = MaterialTheme.typography.titleMedium)- Text(state.settings.destinationLabel())+ Text(stringResource(R.string.dashboard_status), style = MaterialTheme.typography.titleMedium)+ Text(state.settings.destinationLabel(LocalContext.current)) Text(- if (state.settings.lastRun > 0) "Last run: ${state.settings.lastRun.asDateTime()}"- else "No backup has run yet.",+ if (state.settings.lastRun > 0) stringResource(+ R.string.dashboard_last_run,+ state.settings.lastRun.asDateTime(),+ )+ else stringResource(R.string.dashboard_no_backup_yet), style = MaterialTheme.typography.bodyMedium, ) }@@ -72,20 +78,20 @@ fun DashboardScreen( Card(modifier = Modifier.fillMaxWidth()) { Column(Modifier.padding(vertical = 8.dp).fillMaxWidth()) { Text(- "What to back up",+ stringResource(R.string.dashboard_what_to_back_up), style = MaterialTheme.typography.titleMedium, modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), ) ListItem(- headlineContent = { Text("App data (system transport)") },- supportingContent = { Text("Requires a platform-signed system install.") },+ headlineContent = { Text(stringResource(R.string.dashboard_app_data)) },+ supportingContent = { Text(stringResource(R.string.dashboard_app_data_hint)) }, trailingContent = { Switch(checked = state.settings.appBackupEnabled, onCheckedChange = onAppBackupToggle) }, ) ListItem(- headlineContent = { Text("Photos, videos & audio") },- supportingContent = { Text("Encrypted file backup on a schedule.") },+ headlineContent = { Text(stringResource(R.string.dashboard_media)) },+ supportingContent = { Text(stringResource(R.string.dashboard_media_hint)) }, trailingContent = { Switch(checked = state.settings.fileBackupEnabled, onCheckedChange = onFileBackupToggle) },@@ -97,13 +103,13 @@ fun DashboardScreen( onClick = onBackupNow, enabled = !state.busy, modifier = Modifier.fillMaxWidth(),- ) { Text("Back up files now") }+ ) { Text(stringResource(R.string.dashboard_backup_now)) } OutlinedButton( onClick = onRestoreNow, enabled = !state.busy, modifier = Modifier.fillMaxWidth(),- ) { Text("Restore files") }+ ) { Text(stringResource(R.string.dashboard_restore_files)) } BackendSection(state.settings, onPickFolder, onSetWebDav) }
backup/src/main/java/com/vayunmathur/backup/ui/OnboardingScreen.kt
diff --git a/backup/src/main/java/com/vayunmathur/backup/ui/OnboardingScreen.kt b/backup/src/main/java/com/vayunmathur/backup/ui/OnboardingScreen.ktindex 24509dcb06..82eebe05c4 100644--- a/backup/src/main/java/com/vayunmathur/backup/ui/OnboardingScreen.kt+++ b/backup/src/main/java/com/vayunmathur/backup/ui/OnboardingScreen.kt@@ -15,7 +15,9 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier+import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp+import com.vayunmathur.backup.R import com.vayunmathur.backup.platform.BackupUiState import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.Button@@ -40,7 +42,7 @@ fun OnboardingScreen( onRestoreWithCode: (List<String>) -> Unit, onDismissMessages: () -> Unit, ) {- AppScaffold(title = "Set up Backup") { padding ->+ AppScaffold(title = stringResource(R.string.onboarding_title)) { padding -> // Letterboxed on expanded windows so the form keeps a readable measure. DesktopMaxWidthContainer(Modifier.padding(padding)) { Column(@@ -54,8 +56,7 @@ fun OnboardingScreen( state.message?.let { Text(it, color = MaterialTheme.colorScheme.primary) } Text(- "Your backups are encrypted with a 12-word recovery code. Write it down — it is the " +- "only way to restore on a new device.",+ stringResource(R.string.onboarding_recovery_explanation), style = MaterialTheme.typography.bodyMedium, ) @@ -88,19 +89,19 @@ private fun RecoveryCodeCard( modifier = Modifier.padding(16.dp).fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(12.dp), ) {- Text("Recovery code", style = MaterialTheme.typography.titleMedium)+ Text(stringResource(R.string.recovery_code_title), style = MaterialTheme.typography.titleMedium) Row(modifier = Modifier.fillMaxWidth()) { FilterChip( selected = mode == SetupMode.NEW, onClick = { mode = SetupMode.NEW },- label = { Text("New backup") },+ label = { Text(stringResource(R.string.recovery_new_backup)) }, ) Spacer(Modifier.width(8.dp)) FilterChip( selected = mode == SetupMode.RESTORE, onClick = { mode = SetupMode.RESTORE },- label = { Text("Restore existing") },+ label = { Text(stringResource(R.string.recovery_restore_existing)) }, ) } @@ -123,10 +124,10 @@ private fun NewCodeSection( Button( onClick = { onInteract(); onGenerate() }, modifier = Modifier.fillMaxWidth(),- ) { Text("Generate recovery code") }+ ) { Text(stringResource(R.string.recovery_generate)) } return }- val numbered = generatedCode.mapIndexed { i, w -> "${i + 1}. $w" }.joinToString("\n")+ val numbered = generatedCode.mapIndexed { i, w -> stringResource(R.string.recovery_word_numbered, i + 1, w) }.joinToString("\n") Text( numbered, style = MaterialTheme.typography.bodyLarge,@@ -135,7 +136,7 @@ private fun NewCodeSection( Button( onClick = { onConfirmNew(generatedCode) }, modifier = Modifier.fillMaxWidth(),- ) { Text("I saved it — enable encrypted backups") }+ ) { Text(stringResource(R.string.recovery_confirm_saved)) } } @Composable@@ -147,7 +148,7 @@ private fun RestoreCodeSection( OutlinedTextField( value = text, onValueChange = { text = it; onInteract() },- label = { Text("Enter your 12-word recovery code") },+ label = { Text(stringResource(R.string.recovery_enter_code)) }, modifier = Modifier.fillMaxWidth(), minLines = 3, )@@ -155,5 +156,5 @@ private fun RestoreCodeSection( onClick = { onRestoreWithCode(text.trim().split(Regex("\\s+"))) }, enabled = text.isNotBlank(), modifier = Modifier.fillMaxWidth(),- ) { Text("Restore with recovery code") }+ ) { Text(stringResource(R.string.recovery_restore_with_code)) } }
backup/src/main/java/com/vayunmathur/backup/ui/components/BackendSection.kt
diff --git a/backup/src/main/java/com/vayunmathur/backup/ui/components/BackendSection.kt b/backup/src/main/java/com/vayunmathur/backup/ui/components/BackendSection.ktindex bdb75f00d5..db4eace525 100644--- a/backup/src/main/java/com/vayunmathur/backup/ui/components/BackendSection.kt+++ b/backup/src/main/java/com/vayunmathur/backup/ui/components/BackendSection.kt@@ -13,7 +13,11 @@ import androidx.compose.ui.Modifier import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.PasswordVisualTransformation+import android.content.Context+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp+import com.vayunmathur.backup.R import com.vayunmathur.backup.data.BackendType import com.vayunmathur.backup.data.BackupSettings import com.vayunmathur.library.ui.Button@@ -24,10 +28,14 @@ import com.vayunmathur.library.ui.OutlinedTextField import com.vayunmathur.library.ui.Text /** Human-readable summary of the currently selected destination. */-fun BackupSettings.destinationLabel(): String = when (backendType) {- BackendType.NONE -> "No destination selected"- BackendType.SAF -> "Folder: " + (safTreeUri?.substringAfterLast(':')?.substringAfterLast('/') ?: "selected")- BackendType.WEBDAV -> "WebDAV: $webdavUrl"+fun BackupSettings.destinationLabel(context: Context): String = when (backendType) {+ BackendType.NONE -> context.getString(R.string.destination_none)+ BackendType.SAF -> context.getString(+ R.string.destination_folder,+ safTreeUri?.substringAfterLast(':')?.substringAfterLast('/')+ ?: context.getString(R.string.destination_selected),+ )+ BackendType.WEBDAV -> context.getString(R.string.destination_webdav, webdavUrl) } /** Lets the user pick a SAF folder or configure a WebDAV/Nextcloud remote. */@@ -42,15 +50,15 @@ fun BackendSection( modifier = Modifier.padding(16.dp).fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(8.dp), ) {- Text("Backup destination", style = MaterialTheme.typography.titleMedium)- Text(settings.destinationLabel(), style = MaterialTheme.typography.bodyMedium)+ Text(stringResource(R.string.backend_title), style = MaterialTheme.typography.titleMedium)+ Text(settings.destinationLabel(LocalContext.current), style = MaterialTheme.typography.bodyMedium) Button(onClick = onPickFolder, modifier = Modifier.fillMaxWidth()) {- Text("Choose folder (USB / SD / internal)")+ Text(stringResource(R.string.backend_choose_folder)) } HorizontalDivider()- Text("or a WebDAV / Nextcloud remote", style = MaterialTheme.typography.labelLarge)+ Text(stringResource(R.string.backend_or_webdav), style = MaterialTheme.typography.labelLarge) var url by remember(settings.webdavUrl) { mutableStateOf(settings.webdavUrl) } var user by remember(settings.webdavUser) { mutableStateOf(settings.webdavUser) }@@ -59,7 +67,7 @@ fun BackendSection( OutlinedTextField( value = url, onValueChange = { url = it },- label = { Text("WebDAV URL") },+ label = { Text(stringResource(R.string.backend_webdav_url)) }, singleLine = true, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri), modifier = Modifier.fillMaxWidth(),@@ -67,14 +75,14 @@ fun BackendSection( OutlinedTextField( value = user, onValueChange = { user = it },- label = { Text("Username") },+ label = { Text(stringResource(R.string.backend_username)) }, singleLine = true, modifier = Modifier.fillMaxWidth(), ) OutlinedTextField( value = password, onValueChange = { password = it },- label = { Text("Password") },+ label = { Text(stringResource(R.string.backend_password)) }, singleLine = true, visualTransformation = PasswordVisualTransformation(), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),@@ -84,7 +92,7 @@ fun BackendSection( onClick = { onSetWebDav(url, user, password) }, enabled = url.isNotBlank(), modifier = Modifier.fillMaxWidth(),- ) { Text("Save WebDAV destination") }+ ) { Text(stringResource(R.string.backend_save_webdav)) } } } }
backup/src/main/res/values/strings.xml
diff --git a/backup/src/main/res/values/strings.xml b/backup/src/main/res/values/strings.xmlindex 20baa57901..a8554094ee 100644--- a/backup/src/main/res/values/strings.xml+++ b/backup/src/main/res/values/strings.xml@@ -8,4 +8,71 @@ --> <string name="data_management_label">Backup settings</string> <string name="destination_not_configured">Not configured</string>++ <!-- DashboardScreen: progress label shown while a backup or restore is running. -->+ <string name="dashboard_working">Working…</string>+ <!-- DashboardScreen: heading of the status card. Noun. -->+ <string name="dashboard_status">Status</string>+ <!-- DashboardScreen: last backup time in the status card. %1$s is the formatted date and time. -->+ <string name="dashboard_last_run">Last run: %1$s</string>+ <!-- DashboardScreen: status text shown before any backup has run. -->+ <string name="dashboard_no_backup_yet">No backup has run yet.</string>+ <!-- DashboardScreen: heading of the card with the per-category backup toggles. -->+ <string name="dashboard_what_to_back_up">What to back up</string>+ <!-- DashboardScreen: toggle label for app data backed up via the system transport. -->+ <string name="dashboard_app_data">App data (system transport)</string>+ <!-- DashboardScreen: supporting text under the app-data toggle. -->+ <string name="dashboard_app_data_hint">Requires a platform-signed system install.</string>+ <!-- DashboardScreen: toggle label for media file backup. -->+ <string name="dashboard_media">Photos, videos & audio</string>+ <!-- DashboardScreen: supporting text under the media toggle. -->+ <string name="dashboard_media_hint">Encrypted file backup on a schedule.</string>+ <!-- DashboardScreen: button that starts a file backup immediately. Verb phrase. -->+ <string name="dashboard_backup_now">Back up files now</string>+ <!-- DashboardScreen: button that restores files from the destination. Verb phrase. -->+ <string name="dashboard_restore_files">Restore files</string>++ <!-- OnboardingScreen: top-bar title of the first-run setup screen. -->+ <string name="onboarding_title">Set up Backup</string>+ <!-- OnboardingScreen: explanation of the recovery code shown at the top of setup. -->+ <string name="onboarding_recovery_explanation">Your backups are encrypted with a 12-word recovery code. Write it down — it is the only way to restore on a new device.</string>+ <!-- OnboardingScreen: heading of the recovery code card. Noun phrase. -->+ <string name="recovery_code_title">Recovery code</string>+ <!-- OnboardingScreen: chip for creating a new backup with a fresh recovery code. -->+ <string name="recovery_new_backup">New backup</string>+ <!-- OnboardingScreen: chip for restoring an existing backup with its recovery code. -->+ <string name="recovery_restore_existing">Restore existing</string>+ <!-- OnboardingScreen: button that generates a new 12-word recovery code. Verb phrase. -->+ <string name="recovery_generate">Generate recovery code</string>+ <!-- OnboardingScreen: button confirming the user saved the generated code, enabling backups. -->+ <string name="recovery_confirm_saved">I saved it — enable encrypted backups</string>+ <!-- OnboardingScreen: one numbered word of the generated recovery code. %1$d is the word position, %2$s is the word. -->+ <string name="recovery_word_numbered">%1$d. %2$s</string>+ <!-- OnboardingScreen: label of the field where an existing 12-word recovery code is entered. -->+ <string name="recovery_enter_code">Enter your 12-word recovery code</string>+ <!-- OnboardingScreen: button that restores using the entered recovery code. Verb phrase. -->+ <string name="recovery_restore_with_code">Restore with recovery code</string>++ <!-- BackendSection: destination summary when no destination has been selected. -->+ <string name="destination_none">No destination selected</string>+ <!-- BackendSection: destination summary for a picked folder. %1$s is the folder name. -->+ <string name="destination_folder">Folder: %1$s</string>+ <!-- BackendSection: fallback folder name in the destination summary when the folder name cannot be read. -->+ <string name="destination_selected">selected</string>+ <!-- BackendSection: destination summary for a WebDAV remote. %1$s is the WebDAV URL. -->+ <string name="destination_webdav">WebDAV: %1$s</string>+ <!-- BackendSection: heading of the backup destination card. Noun phrase. -->+ <string name="backend_title">Backup destination</string>+ <!-- BackendSection: button that opens the folder picker. Verb phrase. -->+ <string name="backend_choose_folder">Choose folder (USB / SD / internal)</string>+ <!-- BackendSection: divider label introducing the WebDAV remote option. -->+ <string name="backend_or_webdav">or a WebDAV / Nextcloud remote</string>+ <!-- BackendSection: label of the WebDAV URL field. Noun phrase. -->+ <string name="backend_webdav_url">WebDAV URL</string>+ <!-- BackendSection: label of the WebDAV username field. Noun. -->+ <string name="backend_username">Username</string>+ <!-- BackendSection: label of the WebDAV password field. Noun. -->+ <string name="backend_password">Password</string>+ <!-- BackendSection: button that saves the entered WebDAV destination. Verb phrase. -->+ <string name="backend_save_webdav">Save WebDAV destination</string> </resources>
backup/src/test/java/com/vayunmathur/backup/data/BackupConfigTest.kt
diff --git a/backup/src/test/java/com/vayunmathur/backup/data/BackupConfigTest.kt b/backup/src/test/java/com/vayunmathur/backup/data/BackupConfigTest.ktindex 65d360f8ff..76f9cb0024 100644--- a/backup/src/test/java/com/vayunmathur/backup/data/BackupConfigTest.kt+++ b/backup/src/test/java/com/vayunmathur/backup/data/BackupConfigTest.kt@@ -63,10 +63,10 @@ class BackupConfigTest { } @Test fun destinationLabels() {- assertEquals("No destination selected", BackupSettings().destinationLabel())- assertEquals("WebDAV: https://h/x", BackupSettings(BackendType.WEBDAV, webdavUrl = "https://h/x").destinationLabel())- assertTrue(BackupSettings(BackendType.SAF, safTreeUri = "content://tree/primary:Documents/Backups").destinationLabel().startsWith("Folder:"))- assertEquals("Folder: selected", BackupSettings(BackendType.SAF, safTreeUri = "noslash").destinationLabel().let { if (it.contains("noslash")) "Folder: selected" else it })+ assertEquals("No destination selected", BackupSettings().destinationLabel(ctx))+ assertEquals("WebDAV: https://h/x", BackupSettings(BackendType.WEBDAV, webdavUrl = "https://h/x").destinationLabel(ctx))+ assertTrue(BackupSettings(BackendType.SAF, safTreeUri = "content://tree/primary:Documents/Backups").destinationLabel(ctx).startsWith("Folder:"))+ assertEquals("Folder: selected", BackupSettings(BackendType.SAF, safTreeUri = "noslash").destinationLabel(ctx).let { if (it.contains("noslash")) "Folder: selected" else it }) } @Test fun backendFactoryBranches() {
globalesim/src/main/java/com/vayunmathur/globalesim/ui/CardPaymentSheet.kt
diff --git a/globalesim/src/main/java/com/vayunmathur/globalesim/ui/CardPaymentSheet.kt b/globalesim/src/main/java/com/vayunmathur/globalesim/ui/CardPaymentSheet.ktindex de045f7cb1..9c8de94b43 100644--- a/globalesim/src/main/java/com/vayunmathur/globalesim/ui/CardPaymentSheet.kt+++ b/globalesim/src/main/java/com/vayunmathur/globalesim/ui/CardPaymentSheet.kt@@ -17,11 +17,13 @@ import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusDirection+import androidx.compose.ui.res.stringResource import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.unit.dp+import com.vayunmathur.globalesim.R import com.vayunmathur.globalesim.domain.CardValidation import com.vayunmathur.globalesim.domain.CardValidation.ValidCard import com.vayunmathur.globalesim.domain.QuoteMath@@ -53,11 +55,11 @@ fun CardPaymentSheet( .padding(horizontal = 16.dp).padding(bottom = 24.dp), ) { Text(- "Pay ${QuoteMath.formatCents(amountCents)}",+ stringResource(R.string.pay_amount, QuoteMath.formatCents(amountCents)), style = MaterialTheme.typography.titleLarge, ) Text(- "Credit lands in your eSIM wallet shortly.",+ stringResource(R.string.card_credit_hint), style = MaterialTheme.typography.bodyMedium, modifier = Modifier.padding(top = 2.dp), )@@ -83,7 +85,7 @@ fun CardPaymentSheet( OutlinedTextField( value = number, onValueChange = { number = it.filter { c -> c.isDigit() || c == ' ' }.take(23); touched = true },- label = { Text("Card number") },+ label = { Text(stringResource(R.string.card_number_label)) }, placeholder = { Text("4242 4242 4242 4242") }, keyboardOptions = KeyboardOptions( keyboardType = KeyboardType.Number,@@ -103,8 +105,8 @@ fun CardPaymentSheet( OutlinedTextField( value = expiry, onValueChange = { expiry = it.take(7); touched = true },- label = { Text("Expiry") },- placeholder = { Text("MM/YY") },+ label = { Text(stringResource(R.string.expiry_label)) },+ placeholder = { Text(stringResource(R.string.expiry_placeholder)) }, keyboardOptions = KeyboardOptions( keyboardType = KeyboardType.Number, imeAction = ImeAction.Next,@@ -119,7 +121,7 @@ fun CardPaymentSheet( OutlinedTextField( value = cvc, onValueChange = { cvc = it.filter { c -> c.isDigit() }.take(4); touched = true },- label = { Text("CVC") },+ label = { Text(stringResource(R.string.cvc_label)) }, placeholder = { Text("123") }, visualTransformation = PasswordVisualTransformation(), keyboardOptions = KeyboardOptions(@@ -143,7 +145,7 @@ fun CardPaymentSheet( enabled = !paying && validCard != null, modifier = Modifier.fillMaxWidth().padding(top = 12.dp), ) {- Text(if (confirming) "Confirming…" else "Pay ${QuoteMath.formatCents(amountCents)}")+ Text(if (confirming) stringResource(R.string.confirming) else stringResource(R.string.pay_amount, QuoteMath.formatCents(amountCents))) } } }
globalesim/src/main/java/com/vayunmathur/globalesim/ui/ClaimCard.kt
diff --git a/globalesim/src/main/java/com/vayunmathur/globalesim/ui/ClaimCard.kt b/globalesim/src/main/java/com/vayunmathur/globalesim/ui/ClaimCard.ktindex 50ee071304..e986aebabc 100644--- a/globalesim/src/main/java/com/vayunmathur/globalesim/ui/ClaimCard.kt+++ b/globalesim/src/main/java/com/vayunmathur/globalesim/ui/ClaimCard.kt@@ -9,7 +9,9 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier+import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp+import com.vayunmathur.globalesim.R import com.vayunmathur.library.ui.Card import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.OutlinedButton@@ -22,11 +24,11 @@ fun ClaimCard(busy: Boolean, onClaim: (String) -> Unit, modifier: Modifier = Mod var simId by rememberSaveable { mutableStateOf("") } Card(modifier.fillMaxWidth()) { Column(Modifier.padding(16.dp)) {- Text("Already have an eSIM on another phone?", style = MaterialTheme.typography.bodyMedium)+ Text(stringResource(R.string.claim_title), style = MaterialTheme.typography.bodyMedium) OutlinedTextField( value = simId, onValueChange = { simId = it },- label = { Text("SIM ID") },+ label = { Text(stringResource(R.string.sim_id)) }, singleLine = true, modifier = Modifier.fillMaxWidth().padding(top = 8.dp), )@@ -35,7 +37,7 @@ fun ClaimCard(busy: Boolean, onClaim: (String) -> Unit, modifier: Modifier = Mod enabled = !busy && simId.isNotBlank(), modifier = Modifier.fillMaxWidth().padding(top = 8.dp), ) {- Text("Claim on this phone")+ Text(stringResource(R.string.claim_action)) } } }
globalesim/src/main/java/com/vayunmathur/globalesim/ui/HomeScreen.kt
diff --git a/globalesim/src/main/java/com/vayunmathur/globalesim/ui/HomeScreen.kt b/globalesim/src/main/java/com/vayunmathur/globalesim/ui/HomeScreen.ktindex 7ff0f26ec0..deb9419cc0 100644--- a/globalesim/src/main/java/com/vayunmathur/globalesim/ui/HomeScreen.kt+++ b/globalesim/src/main/java/com/vayunmathur/globalesim/ui/HomeScreen.kt@@ -23,8 +23,10 @@ import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.core.net.toUri+import com.vayunmathur.globalesim.R import com.vayunmathur.globalesim.network.ProfileDto import com.vayunmathur.globalesim.domain.QuoteMath import com.vayunmathur.globalesim.domain.buildActivationCode@@ -79,7 +81,7 @@ fun HomeScreen( onPresentPaymentSheet = onPresentPaymentSheet, ) AppScaffold(- title = "Purchase",+ title = stringResource(R.string.purchase_title), ) { padding -> AppPullToRefreshBox( isRefreshing = state.refreshing,@@ -96,9 +98,9 @@ fun HomeScreen( when { !state.statusLoaded -> LoadingIndicator() profile == null && state.pendingCreditCents > 0 -> {- Text("Payment received", style = MaterialTheme.typography.titleMedium)+ Text(stringResource(R.string.payment_received), style = MaterialTheme.typography.titleMedium) Text(- "Creating your eSIM. This page updates on its own.",+ stringResource(R.string.creating_esim), modifier = Modifier.padding(top = 4.dp), ) }@@ -142,24 +144,24 @@ fun HomeScreen( try { context.startActivity(intent) } catch (_: ActivityNotFoundException) {- messenger.show("This phone doesn't have the eSIM installer.")+ messenger.show(context.getString(R.string.no_esim_installer)) } }, modifier = Modifier.weight(1f), ) {- Text("Install eSIM")+ Text(stringResource(R.string.install_esim)) } OutlinedButton( onClick = { state.simId?.let { copySimId(context, it)- messenger.show("SIM ID copied. Paste it into Claim on your new phone.")+ messenger.show(context.getString(R.string.sim_id_copied)) } }, enabled = state.simId != null, modifier = Modifier.weight(1f), ) {- Text("Copy SIM ID")+ Text(stringResource(R.string.copy_sim_id)) } } }@@ -171,19 +173,19 @@ fun HomeScreen( /** Setup terms for a phone with no eSIM yet. The $3 fee gets its own line. */ @Composable private fun SetupTerms() {- Text("One global eSIM for 200+ countries", style = MaterialTheme.typography.titleMedium)+ Text(stringResource(R.string.setup_headline), style = MaterialTheme.typography.titleMedium) Text(- "Pay as you go, credit never expires. No email, phone number or KYC.",+ stringResource(R.string.setup_subtitle), modifier = Modifier.padding(top = 4.dp), ) Text(- "$3 one-time setup fee",+ stringResource(R.string.setup_fee_title), style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary, modifier = Modifier.padding(top = 12.dp), ) Text(- "Taken from your first top-up ($5 minimum). A $5 top-up leaves $2 of credit.",+ stringResource(R.string.setup_fee_detail), style = MaterialTheme.typography.bodyMedium, modifier = Modifier.padding(top = 2.dp), )@@ -198,12 +200,16 @@ private fun BalanceSummary(profile: ProfileDto, stale: Boolean, pendingCreditCen style = MaterialTheme.typography.headlineMedium, ) Text(- "Balance · ${statusLabel(profile.status)}" + if (stale && !unknown) " · last known" else "",+ if (stale && !unknown) {+ stringResource(R.string.balance_with_status_last_known, statusLabel(profile.status))+ } else {+ stringResource(R.string.balance_with_status, statusLabel(profile.status))+ }, style = MaterialTheme.typography.bodyMedium, ) if (pendingCreditCents > 0) { Text(- "${QuoteMath.formatCents(pendingCreditCents)} on its way. No need to pay again.",+ stringResource(R.string.pending_credit_on_its_way, QuoteMath.formatCents(pendingCreditCents)), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.primary, modifier = Modifier.padding(top = 4.dp),@@ -211,19 +217,20 @@ private fun BalanceSummary(profile: ProfileDto, stale: Boolean, pendingCreditCen } } +@Composable private fun statusLabel(status: String): String = when (status) {- "pending" -> "Activating"- "active" -> "Active"- "suspended" -> "Paused"- "terminated" -> "Terminated"- "unknown" -> "Checking…"+ "pending" -> stringResource(R.string.status_activating)+ "active" -> stringResource(R.string.status_active)+ "suspended" -> stringResource(R.string.status_paused)+ "terminated" -> stringResource(R.string.status_terminated)+ "unknown" -> stringResource(R.string.status_checking) else -> status.replaceFirstChar { it.uppercase() } } /** The SIM ID is the account's only credential: flag the clip as sensitive so it isn't previewed. */ @SuppressLint("InlinedApi") // Before Android 13 the extra is ignored; the copy still works. private fun copySimId(context: Context, simId: String) {- val clip = ClipData.newPlainText("SIM ID", simId).apply {+ val clip = ClipData.newPlainText(context.getString(R.string.sim_id), simId).apply { description.extras = PersistableBundle().apply { putBoolean(ClipDescription.EXTRA_IS_SENSITIVE, true) }
globalesim/src/main/java/com/vayunmathur/globalesim/ui/PricingScreen.kt
diff --git a/globalesim/src/main/java/com/vayunmathur/globalesim/ui/PricingScreen.kt b/globalesim/src/main/java/com/vayunmathur/globalesim/ui/PricingScreen.ktindex 990a1558b9..625e823fa8 100644--- a/globalesim/src/main/java/com/vayunmathur/globalesim/ui/PricingScreen.kt+++ b/globalesim/src/main/java/com/vayunmathur/globalesim/ui/PricingScreen.kt@@ -17,8 +17,10 @@ import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color+import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp+import com.vayunmathur.globalesim.R import com.vayunmathur.globalesim.domain.QuoteMath import com.vayunmathur.globalesim.platform.EsimUiState import com.vayunmathur.library.ui.CommonSearchBar@@ -33,6 +35,7 @@ import com.vayunmathur.library.ui.OutlinedButton import com.vayunmathur.library.ui.Surface import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TopAppBar+import com.vayunmathur.library.ui.R as UiR import com.vayunmathur.library.ui.animatedColor import com.vayunmathur.library.ui.animatedDp @@ -65,7 +68,7 @@ fun PricingScreen( CommonSearchBar( value = query, onValueChange = { query = it },- placeholder = "Search countries",+ placeholder = stringResource(R.string.search_countries), padding = PaddingValues(bottom = 8.dp), ) },@@ -78,15 +81,15 @@ fun PricingScreen( item(key = "pricing-empty") { if (query.isBlank()) { EmptyState(- title = "No rates yet",- message = "Rates couldn't be loaded.",+ title = stringResource(R.string.no_rates_yet),+ message = stringResource(R.string.rates_load_failed), icon = { IconSim() },- action = { OutlinedButton(onClick = onRefresh) { Text("Retry") } },+ action = { OutlinedButton(onClick = onRefresh) { Text(stringResource(UiR.string.retry)) } }, ) } else { EmptyState(- title = "No matches",- message = "Try another country name or code.",+ title = stringResource(R.string.no_matches),+ message = stringResource(R.string.no_matches_hint), icon = { IconSim() }, ) }@@ -123,7 +126,7 @@ fun PricingScreen( ) }, supportingContent = {- Text("from ${QuoteMath.formatCents(rate.pricePerGbUsdCents)} / GB")+ Text(stringResource(R.string.price_from_per_gb, QuoteMath.formatCents(rate.pricePerGbUsdCents))) }, colors = ListItemDefaults.colors(containerColor = Color.Transparent), )@@ -141,8 +144,10 @@ fun PricingScreen( ListItem( content = { Text(- "Carrier breakdown unavailable — " +- "charged at ${QuoteMath.formatCents(rate.pricePerGbUsdCents)} / GB.",+ stringResource(+ R.string.carrier_breakdown_unavailable,+ QuoteMath.formatCents(rate.pricePerGbUsdCents),+ ), ) }, colors = ListItemDefaults.colors(containerColor = Color.Transparent),@@ -152,7 +157,7 @@ fun PricingScreen( ListItem( content = { Text(net.operator) }, supportingContent = {- Text(QuoteMath.formatCents(net.pricePerGbUsdCents) + " / GB")+ Text(stringResource(R.string.price_per_gb, QuoteMath.formatCents(net.pricePerGbUsdCents))) }, colors = ListItemDefaults.colors(containerColor = Color.Transparent), )
globalesim/src/main/java/com/vayunmathur/globalesim/ui/TopUpCard.kt
diff --git a/globalesim/src/main/java/com/vayunmathur/globalesim/ui/TopUpCard.kt b/globalesim/src/main/java/com/vayunmathur/globalesim/ui/TopUpCard.ktindex b5033ae040..6525311c54 100644--- a/globalesim/src/main/java/com/vayunmathur/globalesim/ui/TopUpCard.kt+++ b/globalesim/src/main/java/com/vayunmathur/globalesim/ui/TopUpCard.kt@@ -18,9 +18,11 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.unit.dp import androidx.core.net.toUri+import com.vayunmathur.globalesim.R import com.vayunmathur.globalesim.domain.QuoteMath import com.vayunmathur.globalesim.domain.QuoteMath.PAYMENT_MAX_CENTS import com.vayunmathur.globalesim.domain.QuoteMath.PAYMENT_MIN_CENTS@@ -31,6 +33,7 @@ import com.vayunmathur.library.ui.OutlinedButton import com.vayunmathur.library.ui.OutlinedTextField import com.vayunmathur.library.ui.Surface import com.vayunmathur.library.ui.Text+import com.vayunmathur.library.ui.R as UiR /** * Custom-amount top-up: any dollar amount from $5 to $20, paid by card or@@ -52,9 +55,9 @@ fun TopUpCard( val amountOk = amountCents != null && amountCents in PAYMENT_MIN_CENTS..PAYMENT_MAX_CENTS val inputError: String? = when { amountText.isBlank() -> null- amountCents == null -> "Enter an amount like 10 or 12.50."- amountCents < PAYMENT_MIN_CENTS -> "Minimum ${QuoteMath.formatCents(PAYMENT_MIN_CENTS)} payment."- amountCents > PAYMENT_MAX_CENTS -> "${QuoteMath.formatCents(PAYMENT_MAX_CENTS)} max payment."+ amountCents == null -> stringResource(R.string.topup_invalid_amount)+ amountCents < PAYMENT_MIN_CENTS -> stringResource(R.string.topup_minimum_payment, QuoteMath.formatCents(PAYMENT_MIN_CENTS))+ amountCents > PAYMENT_MAX_CENTS -> stringResource(R.string.topup_max_payment, QuoteMath.formatCents(PAYMENT_MAX_CENTS)) else -> null } Card(modifier.fillMaxWidth()) {@@ -62,7 +65,7 @@ fun TopUpCard( OutlinedTextField( value = amountText, onValueChange = { amountText = it },- label = { Text("Top up amount (USD)") },+ label = { Text(stringResource(R.string.topup_amount_label)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Decimal), singleLine = true, isError = inputError != null,@@ -85,7 +88,7 @@ fun TopUpCard( enabled = !busy && amountOk, modifier = Modifier.weight(1f), ) {- Text("Card topup")+ Text(stringResource(R.string.card_topup)) } BadgedBox(badge = "+5%", modifier = Modifier.weight(1f)) { Button(@@ -93,7 +96,7 @@ fun TopUpCard( enabled = !busy && amountOk && pendingInvoiceUrl == null, modifier = Modifier.fillMaxWidth(), ) {- Text("Crypto topup")+ Text(stringResource(R.string.crypto_topup)) } } }@@ -108,13 +111,13 @@ fun TopUpCard( }, modifier = Modifier.weight(1f), ) {- Text("Reopen checkout")+ Text(stringResource(R.string.reopen_checkout)) } OutlinedButton( onClick = onClearCryptoInvoice, modifier = Modifier.weight(1f), ) {- Text("Cancel")+ Text(stringResource(UiR.string.cancel)) } } }
globalesim/src/main/res/values/strings.xml
diff --git a/globalesim/src/main/res/values/strings.xml b/globalesim/src/main/res/values/strings.xmlindex 41a33e0adc..394a5e4da1 100644--- a/globalesim/src/main/res/values/strings.xml+++ b/globalesim/src/main/res/values/strings.xml@@ -1,4 +1,98 @@ <?xml version="1.0" encoding="utf-8"?> <resources>+ <!-- App name displayed in launcher --> <string name="app_name">Global eSIM</string>++ <!-- HomeScreen: Purchase tab title in the app scaffold. Noun. -->+ <string name="purchase_title">Purchase</string>+ <!-- HomeScreen: Heading shown after a payment while the eSIM is being created. -->+ <string name="payment_received">Payment received</string>+ <!-- HomeScreen: Body under payment_received; the page refreshes itself. -->+ <string name="creating_esim">Creating your eSIM. This page updates on its own.</string>+ <!-- HomeScreen: Messenger message when no app can handle the eSIM install intent. -->+ <string name="no_esim_installer">This phone doesn\'t have the eSIM installer.</string>+ <!-- HomeScreen: Button that hands the activation code to the system eSIM installer. Verb phrase. -->+ <string name="install_esim">Install eSIM</string>+ <!-- HomeScreen: Messenger message after the SIM ID is copied to the clipboard. -->+ <string name="sim_id_copied">SIM ID copied. Paste it into Claim on your new phone.</string>+ <!-- HomeScreen: Button that copies the SIM ID to the clipboard. Verb phrase. -->+ <string name="copy_sim_id">Copy SIM ID</string>+ <!-- ClaimCard/HomeScreen: Label for the SIM ID field and clipboard clip. Noun, keep uppercase ID. -->+ <string name="sim_id">SIM ID</string>+ <!-- HomeScreen SetupTerms: Headline for a phone with no eSIM yet. -->+ <string name="setup_headline">One global eSIM for 200+ countries</string>+ <!-- HomeScreen SetupTerms: Subtitle under setup_headline. KYC is know-your-customer verification. -->+ <string name="setup_subtitle">Pay as you go, credit never expires. No email, phone number or KYC.</string>+ <!-- HomeScreen SetupTerms: One-time setup fee line. $3 is the fee amount in USD. -->+ <string name="setup_fee_title">$3 one-time setup fee</string>+ <!-- HomeScreen SetupTerms: Detail under setup_fee_title. $5/$2 are USD amounts. -->+ <string name="setup_fee_detail">Taken from your first top-up ($5 minimum). A $5 top-up leaves $2 of credit.</string>+ <!-- HomeScreen BalanceSummary: Balance caption. %1$s is the status label, e.g. Active. -->+ <string name="balance_with_status">Balance · %1$s</string>+ <!-- HomeScreen BalanceSummary: Balance caption for a stale (last known) balance. %1$s is the status label. -->+ <string name="balance_with_status_last_known">Balance · %1$s · last known</string>+ <!-- HomeScreen BalanceSummary: Pending credit note. %1$s is the formatted amount, e.g. $5.00. -->+ <string name="pending_credit_on_its_way">%1$s on its way. No need to pay again.</string>+ <!-- HomeScreen statusLabel: Display label for the pending profile status. -->+ <string name="status_activating">Activating</string>+ <!-- HomeScreen statusLabel: Display label for the active profile status. -->+ <string name="status_active">Active</string>+ <!-- HomeScreen statusLabel: Display label for the suspended profile status. -->+ <string name="status_paused">Paused</string>+ <!-- HomeScreen statusLabel: Display label for the terminated profile status. -->+ <string name="status_terminated">Terminated</string>+ <!-- HomeScreen statusLabel: Display label while the unknown profile status is being checked. -->+ <string name="status_checking">Checking…</string>++ <!-- PricingScreen: Placeholder of the country search field. Verb phrase. -->+ <string name="search_countries">Search countries</string>+ <!-- PricingScreen: Empty-state title when no rates are loaded and no search is active. -->+ <string name="no_rates_yet">No rates yet</string>+ <!-- PricingScreen: Empty-state message when rates failed to load. -->+ <string name="rates_load_failed">Rates couldn\'t be loaded.</string>+ <!-- PricingScreen: Empty-state title when the search has no matches. -->+ <string name="no_matches">No matches</string>+ <!-- PricingScreen: Empty-state hint under no_matches. -->+ <string name="no_matches_hint">Try another country name or code.</string>+ <!-- PricingScreen: Collapsed country price line. %1$s is the formatted price, e.g. $1.00. GB is gigabyte, do not translate the unit abbreviation. -->+ <string name="price_from_per_gb">from %1$s / GB</string>+ <!-- PricingScreen: Per-carrier price line. %1$s is the formatted price, e.g. $1.00. -->+ <string name="price_per_gb">%1$s / GB</string>+ <!-- PricingScreen: Fallback line when no carrier breakdown is available. %1$s is the formatted price, e.g. $1.00. -->+ <string name="carrier_breakdown_unavailable">Carrier breakdown unavailable — charged at %1$s / GB.</string>++ <!-- TopUpCard: Label of the custom top-up amount field. USD is the currency code. -->+ <string name="topup_amount_label">Top up amount (USD)</string>+ <!-- TopUpCard: Error when the amount cannot be parsed. 10 and 12.50 are example amounts. -->+ <string name="topup_invalid_amount">Enter an amount like 10 or 12.50.</string>+ <!-- TopUpCard: Error when the amount is below the minimum. %1$s is the formatted minimum, e.g. $5.00. -->+ <string name="topup_minimum_payment">Minimum %1$s payment.</string>+ <!-- TopUpCard: Error when the amount is above the maximum. %1$s is the formatted maximum, e.g. $20.00. -->+ <string name="topup_max_payment">%1$s max payment.</string>+ <!-- TopUpCard: Button that starts a card top-up. Noun phrase. -->+ <string name="card_topup">Card topup</string>+ <!-- TopUpCard: Button that starts a crypto top-up. Noun phrase. -->+ <string name="crypto_topup">Crypto topup</string>+ <!-- TopUpCard: Button that reopens the pending crypto checkout. Verb phrase. -->+ <string name="reopen_checkout">Reopen checkout</string>++ <!-- ClaimCard: Prompt above the SIM ID field. -->+ <string name="claim_title">Already have an eSIM on another phone?</string>+ <!-- ClaimCard: Button that claims the entered SIM ID on this phone. Verb phrase. -->+ <string name="claim_action">Claim on this phone</string>++ <!-- CardPaymentSheet: Pay heading/button. %1$s is the formatted amount, e.g. $10.00. -->+ <string name="pay_amount">Pay %1$s</string>+ <!-- CardPaymentSheet: Subtitle under the pay heading. -->+ <string name="card_credit_hint">Credit lands in your eSIM wallet shortly.</string>+ <!-- CardPaymentSheet: Label of the card number field. Noun phrase. -->+ <string name="card_number_label">Card number</string>+ <!-- CardPaymentSheet: Label of the expiry field. Noun. -->+ <string name="expiry_label">Expiry</string>+ <!-- CardPaymentSheet: Placeholder format hint for the expiry field. MM/YY are month/year placeholders, keep the format. -->+ <string name="expiry_placeholder">MM/YY</string>+ <!-- CardPaymentSheet: Label of the security-code field. CVC is the card verification code abbreviation, keep uppercase. -->+ <string name="cvc_label">CVC</string>+ <!-- CardPaymentSheet: Pay button label while payment is being confirmed. -->+ <string name="confirming">Confirming…</string> </resources>
securemail/src/main/java/com/vayunmathur/securemail/ui/ComposeScreen.kt
diff --git a/securemail/src/main/java/com/vayunmathur/securemail/ui/ComposeScreen.kt b/securemail/src/main/java/com/vayunmathur/securemail/ui/ComposeScreen.ktindex ea25919b0a..d496308ef8 100644--- a/securemail/src/main/java/com/vayunmathur/securemail/ui/ComposeScreen.kt+++ b/securemail/src/main/java/com/vayunmathur/securemail/ui/ComposeScreen.kt@@ -29,6 +29,7 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.unit.dp@@ -41,6 +42,7 @@ import com.vayunmathur.library.ui.OutlinedTextField import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TextButton import com.vayunmathur.library.ui.rememberMessenger+import com.vayunmathur.securemail.R import com.vayunmathur.securemail.data.MailIdentity import com.vayunmathur.securemail.platform.MailUiState import kotlinx.coroutines.launch@@ -71,6 +73,8 @@ fun ComposeScreen( ) { val context = LocalContext.current val messenger = rememberMessenger()+ val invalidOrDuplicateAddress = stringResource(R.string.compose_invalid_or_duplicate_address)+ val enterValidEmail = stringResource(R.string.compose_enter_valid_email) ConsumeMessage(state.message, messenger, onConsumeMessage) var subject by remember { mutableStateOf(initialSubject) } var body by remember { mutableStateOf(initialBody) }@@ -84,7 +88,7 @@ fun ComposeScreen( val email = result.data?.data?.let { contactEmail(context, it) } if (!email.isNullOrBlank()) { if (!onAddRecipient(pickTarget, email)) {- scope.launch { messenger.show("Invalid or duplicate address.") }+ scope.launch { messenger.show(invalidOrDuplicateAddress) } } } }@@ -121,33 +125,33 @@ fun ComposeScreen( FromPicker(identities, draftFrom, onSelectFrom) } RecipientChipField(- label = "To",+ label = stringResource(R.string.to_label), recipients = draftTo, onAdd = { onAddRecipient(0, it) }, onRemove = { onRemoveRecipient(0, it) }, onPickContact = { pickTarget = 0; pickTick++ },- onInvalid = { scope.launch { messenger.show("Enter a valid email address.") } },+ onInvalid = { scope.launch { messenger.show(enterValidEmail) } }, ) RecipientChipField(- label = "Cc",+ label = stringResource(R.string.compose_cc), recipients = draftCc, onAdd = { onAddRecipient(1, it) }, onRemove = { onRemoveRecipient(1, it) }, onPickContact = { pickTarget = 1; pickTick++ },- onInvalid = { scope.launch { messenger.show("Enter a valid email address.") } },+ onInvalid = { scope.launch { messenger.show(enterValidEmail) } }, ) RecipientChipField(- label = "Bcc",+ label = stringResource(R.string.compose_bcc), recipients = draftBcc, onAdd = { onAddRecipient(2, it) }, onRemove = { onRemoveRecipient(2, it) }, onPickContact = { pickTarget = 2; pickTick++ },- onInvalid = { scope.launch { messenger.show("Enter a valid email address.") } },+ onInvalid = { scope.launch { messenger.show(enterValidEmail) } }, ) OutlinedTextField( value = subject, onValueChange = { subject = it },- label = { Text("Subject") },+ label = { Text(stringResource(R.string.compose_subject)) }, modifier = Modifier.fillMaxWidth(), singleLine = true, keyboardOptions = KeyboardOptions(@@ -158,7 +162,7 @@ fun ComposeScreen( OutlinedTextField( value = body, onValueChange = { body = it },- label = { Text("Message") },+ label = { Text(stringResource(R.string.message_label)) }, modifier = Modifier.fillMaxWidth(), minLines = 8, keyboardOptions = KeyboardOptions(@@ -176,8 +180,8 @@ fun ComposeScreen( }, enabled = !state.busy && allRecipients.isNotEmpty() && body.isNotBlank(), modifier = Modifier.weight(1f),- ) { Text(if (state.busy) "Sending…" else "Send") }- Button(onClick = onDiscard, modifier = Modifier.weight(1f)) { Text("Discard") }+ ) { Text(if (state.busy) stringResource(R.string.compose_sending) else stringResource(R.string.compose_send)) }+ Button(onClick = onDiscard, modifier = Modifier.weight(1f)) { Text(stringResource(R.string.compose_discard)) } } } }@@ -190,7 +194,7 @@ private fun FromPicker(identities: List<MailIdentity>, selected: String?, onSele val current = identities.firstOrNull { it.address == selected } ?: identities.first() Box { TextButton(onClick = { open = true }) {- Text("From: ${current.address}", style = MaterialTheme.typography.bodyMedium)+ Text(stringResource(R.string.compose_from_format, current.address), style = MaterialTheme.typography.bodyMedium) } DropdownMenu(expanded = open, onDismissRequest = { open = false }) { identities.forEach { identity ->@@ -198,7 +202,7 @@ private fun FromPicker(identities: List<MailIdentity>, selected: String?, onSele text = { Column { Text(identity.address)- val label = if (identity.isPrimary) "Primary" else identity.label+ val label = if (identity.isPrimary) stringResource(R.string.identity_primary) else identity.label if (label.isNotBlank()) { Text( label,
securemail/src/main/java/com/vayunmathur/securemail/ui/InboxScreen.kt
diff --git a/securemail/src/main/java/com/vayunmathur/securemail/ui/InboxScreen.kt b/securemail/src/main/java/com/vayunmathur/securemail/ui/InboxScreen.ktindex 2f502bdd0d..810918af73 100644--- a/securemail/src/main/java/com/vayunmathur/securemail/ui/InboxScreen.kt+++ b/securemail/src/main/java/com/vayunmathur/securemail/ui/InboxScreen.kt@@ -17,6 +17,8 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.pluralStringResource+import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.vayunmathur.library.ui.AlertDialog import com.vayunmathur.library.ui.AppScaffold@@ -38,6 +40,7 @@ import com.vayunmathur.library.ui.TextButton import com.vayunmathur.library.ui.friendlyErrorMessage import com.vayunmathur.library.ui.TopAppBar import com.vayunmathur.library.ui.rememberMessenger+import com.vayunmathur.library.ui.R as UiR import com.vayunmathur.securemail.R import com.vayunmathur.securemail.data.MailFolder import com.vayunmathur.securemail.data.StoredMessage@@ -73,6 +76,7 @@ fun InboxScreen( ) { val messenger = rememberMessenger() val context = LocalContext.current+ val undoLabel = stringResource(UiR.string.undo) ConsumeMessage(state.message, messenger, actions.onConsumeMessage) var selected by remember(folder) { mutableStateOf(emptySet<String>()) } var confirmDelete by remember { mutableStateOf<List<String>?>(null) }@@ -89,7 +93,7 @@ fun InboxScreen( actions.onTrash(ids) messenger.show( context.resources.getQuantityString(R.plurals.moved_to_trash, ids.size, ids.size),- actionLabel = "Undo",+ actionLabel = undoLabel, ) { actions.onMoveTo(ids, folder) } } selected = emptySet()@@ -115,9 +119,9 @@ fun InboxScreen( Column(Modifier.padding(padding).fillMaxSize()) { state.error?.let { ErrorState(- title = "Something went wrong",+ title = stringResource(R.string.inbox_something_went_wrong), message = friendlyErrorMessage(it),- retryLabel = "Retry",+ retryLabel = stringResource(UiR.string.retry), onRetry = actions.onRetry, ) }@@ -125,7 +129,7 @@ fun InboxScreen( TextButton( onClick = { confirmDelete = messages.map { it.id } }, modifier = Modifier.padding(horizontal = 8.dp),- ) { Text("Empty trash") }+ ) { Text(stringResource(R.string.inbox_empty_trash)) } } if (messages.isEmpty()) { Box(Modifier.fillMaxSize().padding(32.dp), contentAlignment = Alignment.Center) {@@ -163,21 +167,18 @@ fun InboxScreen( val everything = ids.size == messages.size AlertDialog( onDismissRequest = { confirmDelete = null; swipeGeneration++ },- title = { Text(if (everything) "Empty trash?" else "Delete forever?") },+ title = { Text(if (everything) stringResource(R.string.inbox_empty_trash_title) else stringResource(R.string.inbox_delete_forever_title)) }, text = {- Text(- if (ids.size == 1) "This message will be permanently deleted from this device."- else "${ids.size} messages will be permanently deleted from this device.",- )+ Text(pluralStringResource(R.plurals.inbox_permanent_delete_message, ids.size, ids.size)) }, confirmButton = { TextButton(onClick = { if (everything) actions.onEmptyTrash() else actions.onDeleteForever(ids) confirmDelete = null- }) { Text("Delete") }+ }) { Text(stringResource(UiR.string.delete)) } }, dismissButton = {- TextButton(onClick = { confirmDelete = null; swipeGeneration++ }) { Text("Cancel") }+ TextButton(onClick = { confirmDelete = null; swipeGeneration++ }) { Text(stringResource(UiR.string.cancel)) } }, ) }@@ -194,7 +195,7 @@ private fun SelectionBar( onDelete: () -> Unit, ) { TopAppBar(- title = { Text("$count selected") },+ title = { Text(stringResource(R.string.inbox_selected_format, count)) }, navigationIcon = { IconButton(onClick = onClose) { IconClose() } }, actions = { IconButton(onClick = { onSetRead(true) }) { IconMarkRead() }@@ -209,12 +210,13 @@ private fun SelectionBar( ) } +@Composable private fun emptyText(folder: MailFolder): String = when (folder) {- MailFolder.INBOX -> "No mail yet. Share your address to receive encrypted mail."- MailFolder.SENT -> "Nothing sent yet."- MailFolder.DRAFTS -> "No drafts."- MailFolder.SPAM -> "No spam. Verification failures land here."- MailFolder.TRASH -> "Trash is empty."+ MailFolder.INBOX -> stringResource(R.string.inbox_empty_inbox)+ MailFolder.SENT -> stringResource(R.string.empty_nothing_sent)+ MailFolder.DRAFTS -> stringResource(R.string.empty_no_drafts)+ MailFolder.SPAM -> stringResource(R.string.inbox_empty_spam)+ MailFolder.TRASH -> stringResource(R.string.inbox_empty_trash_state) } private fun Set<String>.toggle(id: String): Set<String> = if (id in this) this - id else this + id
securemail/src/main/java/com/vayunmathur/securemail/ui/LockScreen.kt
diff --git a/securemail/src/main/java/com/vayunmathur/securemail/ui/LockScreen.kt b/securemail/src/main/java/com/vayunmathur/securemail/ui/LockScreen.ktindex 1fced928a0..00f262c3ee 100644--- a/securemail/src/main/java/com/vayunmathur/securemail/ui/LockScreen.kt+++ b/securemail/src/main/java/com/vayunmathur/securemail/ui/LockScreen.kt@@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier+import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.Button@@ -14,6 +15,7 @@ import com.vayunmathur.library.ui.DesktopMaxWidthContainer import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.rememberMessenger+import com.vayunmathur.securemail.R import com.vayunmathur.securemail.platform.MailUiState /** Biometric gate: the PGP private key stays wrapped until this succeeds. */@@ -25,7 +27,7 @@ fun LockScreen( ) { val messenger = rememberMessenger() ConsumeMessage(state.message, messenger, onDismissMessages)- AppScaffold(title = "SecureMail locked") { padding ->+ AppScaffold(title = stringResource(R.string.lock_title)) { padding -> DesktopMaxWidthContainer(Modifier.padding(padding)) { Column( modifier = Modifier.fillMaxWidth().padding(16.dp),@@ -37,13 +39,13 @@ fun LockScreen( modifier = Modifier.padding(16.dp).fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(12.dp), ) {- Text("Unlock to read your mail", style = MaterialTheme.typography.titleMedium)+ Text(stringResource(R.string.lock_unlock_to_read), style = MaterialTheme.typography.titleMedium) Text(- "Your PGP private key is sealed until you authenticate.",+ stringResource(R.string.lock_pgp_explainer), style = MaterialTheme.typography.bodyMedium, ) Button(onClick = { onDismissMessages(); onUnlock() }, modifier = Modifier.fillMaxWidth()) {- Text("Unlock")+ Text(stringResource(R.string.lock_unlock)) } } }
securemail/src/main/java/com/vayunmathur/securemail/ui/MailBottomBar.kt
diff --git a/securemail/src/main/java/com/vayunmathur/securemail/ui/MailBottomBar.kt b/securemail/src/main/java/com/vayunmathur/securemail/ui/MailBottomBar.ktindex 1bdbadd8a4..8338118e4c 100644--- a/securemail/src/main/java/com/vayunmathur/securemail/ui/MailBottomBar.kt+++ b/securemail/src/main/java/com/vayunmathur/securemail/ui/MailBottomBar.kt@@ -1,6 +1,7 @@ package com.vayunmathur.securemail.ui import androidx.compose.runtime.Composable+import androidx.compose.ui.res.stringResource import com.vayunmathur.library.ui.Badge import com.vayunmathur.library.ui.BadgedBox import com.vayunmathur.library.ui.IconDelete@@ -11,6 +12,8 @@ import com.vayunmathur.library.ui.IconWarning import com.vayunmathur.library.ui.Text import com.vayunmathur.library.util.BottomNavBar import com.vayunmathur.library.util.BottomNavBarItem+import com.vayunmathur.library.ui.R as UiR+import com.vayunmathur.securemail.R import com.vayunmathur.securemail.data.MailFolder /** Top-level destinations. OUT groups Drafts, the Outbox queue and Sent on one page. */@@ -20,18 +23,18 @@ enum class MailTab { INBOX, SPAM, OUT, TRASH, SETTINGS } @Composable fun MailBottomBar(selected: MailTab, outboxCount: Int, onSelect: (MailTab) -> Unit) { BottomNavBar {- BottomNavBarItem(selected == MailTab.INBOX, { onSelect(MailTab.INBOX) }, { IconInbox() }, "Inbox")- BottomNavBarItem(selected == MailTab.SPAM, { onSelect(MailTab.SPAM) }, { IconWarning() }, "Spam")+ BottomNavBarItem(selected == MailTab.INBOX, { onSelect(MailTab.INBOX) }, { IconInbox() }, stringResource(R.string.tab_inbox))+ BottomNavBarItem(selected == MailTab.SPAM, { onSelect(MailTab.SPAM) }, { IconWarning() }, stringResource(R.string.tab_spam)) BottomNavBarItem( selected = selected == MailTab.OUT, onClick = { onSelect(MailTab.OUT) }, icon = { BadgedBox(badge = { if (outboxCount > 0) Badge { Text("$outboxCount") } }) { IconSend() } },- label = "Out",+ label = stringResource(R.string.tab_out), )- BottomNavBarItem(selected == MailTab.TRASH, { onSelect(MailTab.TRASH) }, { IconDelete() }, "Trash")- BottomNavBarItem(selected == MailTab.SETTINGS, { onSelect(MailTab.SETTINGS) }, { IconSettings() }, "Settings")+ BottomNavBarItem(selected == MailTab.TRASH, { onSelect(MailTab.TRASH) }, { IconDelete() }, stringResource(R.string.tab_trash))+ BottomNavBarItem(selected == MailTab.SETTINGS, { onSelect(MailTab.SETTINGS) }, { IconSettings() }, stringResource(UiR.string.settings)) } }
securemail/src/main/java/com/vayunmathur/securemail/ui/MessageBodyView.kt
diff --git a/securemail/src/main/java/com/vayunmathur/securemail/ui/MessageBodyView.kt b/securemail/src/main/java/com/vayunmathur/securemail/ui/MessageBodyView.ktindex 8c4b59d4da..902bf834a3 100644--- a/securemail/src/main/java/com/vayunmathur/securemail/ui/MessageBodyView.kt+++ b/securemail/src/main/java/com/vayunmathur/securemail/ui/MessageBodyView.kt@@ -18,11 +18,13 @@ import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.TextLinkStyles import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.style.TextDecoration+import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.vayunmathur.library.ui.HtmlText import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TextButton+import com.vayunmathur.securemail.R import com.vayunmathur.securemail.data.StoredMessage /**@@ -51,11 +53,11 @@ private fun HtmlBody(id: String, html: String) { verticalAlignment = Alignment.CenterVertically, ) { Text(- "Remote content blocked",+ stringResource(R.string.body_remote_content_blocked), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant, )- TextButton(onClick = { loadRemote = true }) { Text("Load") }+ TextButton(onClick = { loadRemote = true }) { Text(stringResource(R.string.body_load)) } } } HtmlText(@@ -68,7 +70,7 @@ private fun HtmlBody(id: String, html: String) { ) if (hasQuotes) { TextButton(onClick = { showQuotes = !showQuotes }, modifier = Modifier.padding(horizontal = 8.dp)) {- Text(if (showQuotes) "Hide quoted text" else "Show quoted text")+ Text(if (showQuotes) stringResource(R.string.body_hide_quoted) else stringResource(R.string.body_show_quoted)) } } }@@ -76,7 +78,7 @@ private fun HtmlBody(id: String, html: String) { @Composable private fun PlainBody(msg: StoredMessage) {- val body = msg.decryptedBody ?: "(decrypting\u2026)"+ val body = msg.decryptedBody ?: stringResource(R.string.body_decrypting) var showQuotes by remember(msg.id) { mutableStateOf(false) } val (main, quoted) = remember(body) { splitQuotedText(body) } val linkColor = MaterialTheme.colorScheme.primary@@ -89,7 +91,7 @@ private fun PlainBody(msg: StoredMessage) { ) if (quoted.isNotEmpty()) { TextButton(onClick = { showQuotes = !showQuotes }, modifier = Modifier.padding(horizontal = 8.dp)) {- Text(if (showQuotes) "Hide quoted text" else "Show quoted text")+ Text(if (showQuotes) stringResource(R.string.body_hide_quoted) else stringResource(R.string.body_show_quoted)) } } }
securemail/src/main/java/com/vayunmathur/securemail/ui/MessageRow.kt
diff --git a/securemail/src/main/java/com/vayunmathur/securemail/ui/MessageRow.kt b/securemail/src/main/java/com/vayunmathur/securemail/ui/MessageRow.ktindex 939f99eee2..67037c45a2 100644--- a/securemail/src/main/java/com/vayunmathur/securemail/ui/MessageRow.kt+++ b/securemail/src/main/java/com/vayunmathur/securemail/ui/MessageRow.kt@@ -21,6 +21,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp@@ -37,6 +38,7 @@ import com.vayunmathur.library.ui.Surface import com.vayunmathur.library.ui.SwipeActionSide import com.vayunmathur.library.ui.SwipeActionsBox import com.vayunmathur.library.ui.Text+import com.vayunmathur.securemail.R import com.vayunmathur.securemail.data.StoredMessage import java.text.DateFormat import java.util.Date@@ -94,7 +96,7 @@ fun MessageRow( colors = ListItemDefaults.colors(containerColor = Color.Transparent), ) { Text(- msg.decryptedSubject?.ifBlank { "(no subject)" } ?: "Encrypted message",+ msg.decryptedSubject?.ifBlank { stringResource(R.string.no_subject) } ?: stringResource(R.string.message_encrypted), style = MaterialTheme.typography.bodyLarge, fontWeight = if (msg.isRead) FontWeight.Normal else FontWeight.Bold, maxLines = 1,@@ -110,7 +112,7 @@ fun MessageRow( private fun RowSupport(msg: StoredMessage, showRecipient: Boolean) { Column { Text(- if (showRecipient) "To: ${msg.toJson.ifBlank { "(unknown)" }}" else msg.from.ifBlank { "(encrypted sender)" },+ if (showRecipient) stringResource(R.string.message_to_format, msg.toJson.ifBlank { stringResource(R.string.unknown_parenthesized) }) else msg.from.ifBlank { stringResource(R.string.encrypted_sender_parenthesized) }, style = MaterialTheme.typography.titleSmall, maxLines = 1, overflow = TextOverflow.Ellipsis,@@ -119,7 +121,7 @@ private fun RowSupport(msg: StoredMessage, showRecipient: Boolean) { msg.decryptedBody?.lineSequence()?.map { it.trim() }?.firstOrNull { it.isNotEmpty() } } Text(- preview ?: if (msg.unencrypted) "" else "Open to decrypt",+ preview ?: if (msg.unencrypted) "" else stringResource(R.string.message_open_to_decrypt), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant, maxLines = 1,
securemail/src/main/java/com/vayunmathur/securemail/ui/NavigationEntries.kt
diff --git a/securemail/src/main/java/com/vayunmathur/securemail/ui/NavigationEntries.kt b/securemail/src/main/java/com/vayunmathur/securemail/ui/NavigationEntries.ktindex 36e1a02795..8889ff30eb 100644--- a/securemail/src/main/java/com/vayunmathur/securemail/ui/NavigationEntries.kt+++ b/securemail/src/main/java/com/vayunmathur/securemail/ui/NavigationEntries.kt@@ -5,6 +5,7 @@ import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource import androidx.fragment.app.FragmentActivity import com.vayunmathur.library.util.AppMessages import com.vayunmathur.library.util.EntryProviderScope@@ -25,6 +26,7 @@ import com.vayunmathur.securemail.platform.moveTo import com.vayunmathur.securemail.platform.moveToTrash import com.vayunmathur.securemail.platform.restoreFromTrash import com.vayunmathur.securemail.platform.setRead+import com.vayunmathur.securemail.R import com.vayunmathur.securemail.Route /** Onboarding, lock, inbox, reader and settings destinations. */@@ -92,6 +94,7 @@ internal fun EntryProviderScope<Route>.readerEntry( allMessages: List<StoredMessage>, ) { entry<Route.Reader> { route ->+ val context = LocalContext.current val msg = remember(route.messageId, allMessages) { allMessages.firstOrNull { it.id == route.messageId } }@@ -105,7 +108,7 @@ entry<Route.Reader> { route -> backStack.add( Route.Composer( to = m.from,- subject = "Re: ${m.decryptedSubject ?: ""}",+ subject = context.getString(R.string.reply_subject_format, m.decryptedSubject ?: ""), inReplyTo = m.id, from = m.deliveredTo, ),@@ -132,6 +135,7 @@ internal fun EntryProviderScope<Route>.composerEntry(viewModel: MailViewModel, b from = route.from, ) }+ val draftSaved = stringResource(R.string.draft_saved) fun close() { viewModel.clearDraft() backStack.pop()@@ -167,7 +171,7 @@ internal fun EntryProviderScope<Route>.composerEntry(viewModel: MailViewModel, b ) }, onLeave = { subject, body ->- saveOrDropDraft(viewModel, draftId, subject, body, route.inReplyTo)+ saveOrDropDraft(viewModel, draftId, subject, body, route.inReplyTo, draftSaved) close() }, onDiscard = {@@ -186,6 +190,7 @@ internal fun saveOrDropDraft( subject: String, body: String, inReplyTo: String?,+ draftSaved: String, ) { val draft = Draft( id = draftId,@@ -201,7 +206,7 @@ internal fun saveOrDropDraft( viewModel.drafts.delete(draftId) } else { viewModel.drafts.save(draft)- AppMessages.show("Draft saved")+ AppMessages.show(draftSaved) } }
securemail/src/main/java/com/vayunmathur/securemail/ui/OnboardingScreen.kt
diff --git a/securemail/src/main/java/com/vayunmathur/securemail/ui/OnboardingScreen.kt b/securemail/src/main/java/com/vayunmathur/securemail/ui/OnboardingScreen.ktindex 3227c3a38b..59c4735ce9 100644--- a/securemail/src/main/java/com/vayunmathur/securemail/ui/OnboardingScreen.kt+++ b/securemail/src/main/java/com/vayunmathur/securemail/ui/OnboardingScreen.kt@@ -15,6 +15,7 @@ import androidx.compose.ui.Modifier import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.PasswordVisualTransformation+import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.Button@@ -24,6 +25,7 @@ import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.OutlinedTextField import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.rememberMessenger+import com.vayunmathur.securemail.R import com.vayunmathur.securemail.platform.MailUiState /** First-run: claim an @maemail.org address and generate the PGP identity. */@@ -35,7 +37,7 @@ fun OnboardingScreen( ) { val messenger = rememberMessenger() ConsumeMessage(state.message, messenger, onDismissMessages)- AppScaffold(title = "Set up SecureMail") { padding ->+ AppScaffold(title = stringResource(R.string.onboarding_title)) { padding -> DesktopMaxWidthContainer(Modifier.padding(padding)) { Column( modifier = Modifier@@ -46,8 +48,7 @@ fun OnboardingScreen( ) { state.error?.let { Text(it, color = MaterialTheme.colorScheme.error) } Text(- "Claim an @maemail.org address. A PGP key (Ed25519 + X25519) is " +- "generated on this device — the private key never leaves it.",+stringResource(R.string.onboarding_claim_explainer), style = MaterialTheme.typography.bodyMedium, ) ClaimCard(@@ -68,18 +69,18 @@ private fun ClaimCard(busy: Boolean, onClaim: (String, String) -> Unit) { modifier = Modifier.padding(16.dp).fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(12.dp), ) {- Text("Your address", style = MaterialTheme.typography.titleMedium)+ Text(stringResource(R.string.onboarding_your_address), style = MaterialTheme.typography.titleMedium) OutlinedTextField( value = local, onValueChange = { local = it },- label = { Text("name (→ [email protected])") },+ label = { Text(stringResource(R.string.onboarding_address_label)) }, modifier = Modifier.fillMaxWidth(), singleLine = true, ) OutlinedTextField( value = passphrase, onValueChange = { passphrase = it },- label = { Text("Key passphrase (min 8 chars)") },+ label = { Text(stringResource(R.string.onboarding_passphrase_label)) }, modifier = Modifier.fillMaxWidth(), singleLine = true, visualTransformation = PasswordVisualTransformation(),@@ -89,7 +90,7 @@ private fun ClaimCard(busy: Boolean, onClaim: (String, String) -> Unit) { onClick = { onClaim(local.trim(), passphrase) }, enabled = !busy && local.isNotBlank() && passphrase.isNotBlank(), modifier = Modifier.fillMaxWidth(),- ) { Text(if (busy) "Generating…" else "Claim address + generate key") }+ ) { Text(if (busy) stringResource(R.string.onboarding_generating) else stringResource(R.string.onboarding_claim)) } } } }
securemail/src/main/java/com/vayunmathur/securemail/ui/OutScreen.kt
diff --git a/securemail/src/main/java/com/vayunmathur/securemail/ui/OutScreen.kt b/securemail/src/main/java/com/vayunmathur/securemail/ui/OutScreen.ktindex 2ddf176447..378104eec3 100644--- a/securemail/src/main/java/com/vayunmathur/securemail/ui/OutScreen.kt+++ b/securemail/src/main/java/com/vayunmathur/securemail/ui/OutScreen.kt@@ -15,6 +15,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.pluralStringResource+import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import com.vayunmathur.library.ui.AppScaffold@@ -29,6 +30,7 @@ import com.vayunmathur.library.ui.SwipeActionsBox import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TextButton import com.vayunmathur.library.ui.rememberMessenger+import com.vayunmathur.library.ui.R as UiR import com.vayunmathur.securemail.R import com.vayunmathur.securemail.data.OutboxMessage import com.vayunmathur.securemail.data.StoredMessage@@ -60,12 +62,21 @@ fun OutScreen( actions: OutActions, ) { val messenger = rememberMessenger()+ val undoLabel = stringResource(UiR.string.undo)+ val draftDeleted = stringResource(R.string.out_draft_deleted)+ val movedToTrash = pluralStringResource(R.plurals.moved_to_trash, 1, 1)+ val draftsTitle = stringResource(R.string.out_drafts)+ val noDrafts = stringResource(R.string.empty_no_drafts)+ val outboxTitle = stringResource(R.string.out_outbox)+ val nothingWaiting = stringResource(R.string.out_nothing_waiting)+ val sentTitle = stringResource(R.string.out_sent)+ val nothingSent = stringResource(R.string.empty_nothing_sent) AppScaffold( topBar = {}, floatingActionButton = { FloatingActionButton(onClick = actions.onCompose) { IconAdd() } }, ) { padding -> LazyColumn(Modifier.padding(padding).fillMaxSize()) {- section("Drafts", drafts.isEmpty(), "No drafts.")+ section(draftsTitle, drafts.isEmpty(), noDrafts) itemsIndexed(drafts, key = { _, row -> "d-${row.id}" }) { i, row -> val draft = DraftsController.decode(row) DraftRow(@@ -73,17 +84,17 @@ fun OutScreen( onOpen = { actions.onOpenDraft(draft) }, onDelete = { actions.onDeleteDraft(draft.id)- messenger.show("Draft deleted", actionLabel = "Undo") { actions.onRestoreDraft(draft) }+ messenger.show(draftDeleted, actionLabel = undoLabel) { actions.onRestoreDraft(draft) } }, ) if (i < drafts.lastIndex) HorizontalDivider() } item(key = "div-outbox") { SectionDivider() }- section("Outbox", outbox.isEmpty(), "Nothing waiting to send.")+ section(outboxTitle, outbox.isEmpty(), nothingWaiting) if (outbox.isNotEmpty()) { item(key = "retry") { TextButton(onClick = actions.onRetryOutbox, modifier = Modifier.padding(horizontal = 8.dp)) {- Text("Retry all")+ Text(stringResource(R.string.out_retry_all)) } } }@@ -92,7 +103,7 @@ fun OutScreen( if (i < outbox.lastIndex) HorizontalDivider() } item(key = "div-sent") { SectionDivider() }- section("Sent", sent.isEmpty(), "Nothing sent yet.")+ section(sentTitle, sent.isEmpty(), nothingSent) items(sent, key = { "s-${it.id}" }) { msg -> MessageRow( msg = msg,@@ -103,7 +114,7 @@ fun OutScreen( onToggleRead = { actions.onSetRead(listOf(msg.id), !msg.isRead) }, onSwipeDelete = { actions.onTrashSent(listOf(msg.id))- messenger.show("Moved to Trash", actionLabel = "Undo") { actions.onUntrashSent(listOf(msg.id)) }+ messenger.show(movedToTrash, actionLabel = undoLabel) { actions.onUntrashSent(listOf(msg.id)) } }, inTrash = false, )@@ -158,7 +169,7 @@ private fun DraftRow(draft: Draft, onOpen: () -> Unit, onDelete: () -> Unit) { Column { val recipients = (draft.to + draft.cc + draft.bcc).joinToString(", ") Text(- if (recipients.isEmpty()) "No recipients" else "To: $recipients",+ if (recipients.isEmpty()) stringResource(R.string.out_no_recipients) else stringResource(R.string.message_to_format, recipients), style = MaterialTheme.typography.titleSmall, maxLines = 1, overflow = TextOverflow.Ellipsis,@@ -174,7 +185,7 @@ private fun DraftRow(draft: Draft, onOpen: () -> Unit, onDelete: () -> Unit) { }, ) { Text(- draft.subject.ifBlank { "(no subject)" },+ draft.subject.ifBlank { stringResource(R.string.no_subject) }, style = MaterialTheme.typography.bodyLarge, maxLines = 1, overflow = TextOverflow.Ellipsis,@@ -190,7 +201,7 @@ private fun OutboxRow(entry: OutboxMessage) { supportingContent = { Column { Text(- "To: ${entry.toJson}",+ stringResource(R.string.message_to_format, entry.toJson), style = MaterialTheme.typography.titleSmall, maxLines = 1, overflow = TextOverflow.Ellipsis,@@ -214,7 +225,7 @@ private fun OutboxRow(entry: OutboxMessage) { }, ) { Text(- entry.subject.ifBlank { "(no subject)" },+ entry.subject.ifBlank { stringResource(R.string.no_subject) }, style = MaterialTheme.typography.bodyLarge, maxLines = 1, overflow = TextOverflow.Ellipsis,
securemail/src/main/java/com/vayunmathur/securemail/ui/ReaderScreen.kt
diff --git a/securemail/src/main/java/com/vayunmathur/securemail/ui/ReaderScreen.kt b/securemail/src/main/java/com/vayunmathur/securemail/ui/ReaderScreen.ktindex 09afe06697..8edad229a0 100644--- a/securemail/src/main/java/com/vayunmathur/securemail/ui/ReaderScreen.kt+++ b/securemail/src/main/java/com/vayunmathur/securemail/ui/ReaderScreen.kt@@ -20,6 +20,7 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier+import androidx.compose.ui.res.stringResource import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp@@ -38,6 +39,7 @@ import com.vayunmathur.library.ui.OutlinedButton import com.vayunmathur.library.ui.Surface import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.rememberModalBottomSheetState+import com.vayunmathur.securemail.R import com.vayunmathur.securemail.data.MailFolder import com.vayunmathur.securemail.data.StoredMessage import com.vayunmathur.securemail.platform.MailUiState@@ -59,7 +61,7 @@ fun ReaderScreen( ) { val msg = message AppScaffold(- title = msg?.decryptedSubject?.ifBlank { "(no subject)" } ?: "Message",+ title = msg?.decryptedSubject?.ifBlank { stringResource(R.string.no_subject) } ?: stringResource(R.string.message_label), onNavigateBack = onBack, actions = { if (msg != null) {@@ -71,7 +73,7 @@ fun ReaderScreen( Column(modifier = Modifier.fillMaxWidth().verticalScroll(rememberScrollState())) { if (msg == null) { Text(- "Message not found.",+ stringResource(R.string.reader_not_found), style = MaterialTheme.typography.bodyMedium, modifier = Modifier.padding(16.dp), )@@ -88,7 +90,7 @@ fun ReaderScreen( private fun MessageBody(msg: StoredMessage, ownAddress: String, onReply: () -> Unit) { var showDetails by remember { mutableStateOf(false) } val sent = msg.folder == MailFolder.SENT- val counterpart = if (sent) msg.toJson.ifBlank { "(unknown)" } else msg.from.ifBlank { "(encrypted sender)" }+ val counterpart = if (sent) msg.toJson.ifBlank { stringResource(R.string.unknown_parenthesized) } else msg.from.ifBlank { stringResource(R.string.encrypted_sender_parenthesized) } val date = remember(msg.dateMillis) { DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(Date(msg.dateMillis)) }@@ -109,7 +111,7 @@ private fun MessageBody(msg: StoredMessage, ownAddress: String, onReply: () -> U modifier = Modifier.weight(1f, fill = false), ) Text(- " \u2022 $date",+ stringResource(R.string.reader_date_separator_format, date), style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant, maxLines = 1,@@ -117,7 +119,7 @@ private fun MessageBody(msg: StoredMessage, ownAddress: String, onReply: () -> U ) } Text(- if (sent) "from me" else "to me",+ if (sent) stringResource(R.string.reader_from_me) else stringResource(R.string.reader_to_me), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant, )@@ -131,7 +133,7 @@ private fun MessageBody(msg: StoredMessage, ownAddress: String, onReply: () -> U OutlinedButton(onClick = onReply, modifier = Modifier.weight(1f)) { IconUndo(modifier = Modifier.size(18.dp)) Spacer(Modifier.width(8.dp))- Text("Reply")+ Text(stringResource(R.string.reader_reply)) } } HorizontalDivider()@@ -143,11 +145,11 @@ private fun MessageBody(msg: StoredMessage, ownAddress: String, onReply: () -> U ) { Column(modifier = Modifier.padding(16.dp).fillMaxWidth()) { Text(date, style = MaterialTheme.typography.labelSmall, modifier = Modifier.align(Alignment.End))- DetailRow("From", if (sent) ownAddress else msg.from.ifBlank { "(encrypted sender)" }, avatarColor)- DetailRow("To", if (sent) msg.toJson.ifBlank { "(unknown)" } else ownAddress, MaterialTheme.colorScheme.surfaceVariant)+ DetailRow(stringResource(R.string.from_label), if (sent) ownAddress else msg.from.ifBlank { stringResource(R.string.encrypted_sender_parenthesized) }, avatarColor)+ DetailRow(stringResource(R.string.to_label), if (sent) msg.toJson.ifBlank { stringResource(R.string.unknown_parenthesized) } else ownAddress, MaterialTheme.colorScheme.surfaceVariant) if (msg.verifiedSigner != null) { Spacer(Modifier.height(8.dp))- Text("Signer fingerprint", style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.primary)+ Text(stringResource(R.string.reader_signer_fingerprint), style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.primary) Text( msg.verifiedSigner.chunked(4).joinToString(" "), style = MaterialTheme.typography.bodySmall,@@ -165,12 +167,12 @@ private fun TrustLine(msg: StoredMessage) { val colors = MaterialTheme.colorScheme val sent = msg.folder == MailFolder.SENT val (label, color) = when {- sent && msg.unencrypted -> "Sent unencrypted \u00b7 no key for a recipient" to colors.error- sent -> "Sent encrypted" to colors.primary- msg.unencrypted -> "Not encrypted" to colors.error- msg.verifiedSigner != null -> "Encrypted \u00b7 signature verified" to colors.primary- msg.decryptedBody != null -> "Encrypted \u00b7 signature not verified" to colors.onSurfaceVariant- else -> "Locked \u00b7 decrypting\u2026" to colors.onSurfaceVariant+ sent && msg.unencrypted -> stringResource(R.string.reader_sent_unencrypted) to colors.error+ sent -> stringResource(R.string.reader_sent_encrypted) to colors.primary+ msg.unencrypted -> stringResource(R.string.reader_not_encrypted) to colors.error+ msg.verifiedSigner != null -> stringResource(R.string.reader_encrypted_verified) to colors.primary+ msg.decryptedBody != null -> stringResource(R.string.reader_encrypted_not_verified) to colors.onSurfaceVariant+ else -> stringResource(R.string.reader_locked_decrypting) to colors.onSurfaceVariant } Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(top = 2.dp)) { val iconModifier = Modifier.size(14.dp)
securemail/src/main/java/com/vayunmathur/securemail/ui/RecipientChipField.kt
diff --git a/securemail/src/main/java/com/vayunmathur/securemail/ui/RecipientChipField.kt b/securemail/src/main/java/com/vayunmathur/securemail/ui/RecipientChipField.ktindex a60668f5eb..2526c31f1f 100644--- a/securemail/src/main/java/com/vayunmathur/securemail/ui/RecipientChipField.kt+++ b/securemail/src/main/java/com/vayunmathur/securemail/ui/RecipientChipField.kt@@ -11,6 +11,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier+import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.unit.dp@@ -20,6 +21,7 @@ import com.vayunmathur.library.ui.IconRemoveCircle import com.vayunmathur.library.ui.InputChip import com.vayunmathur.library.ui.OutlinedTextField import com.vayunmathur.library.ui.Text+import com.vayunmathur.securemail.R /** * Recipient field (shared by To/Cc/Bcc): chips above a single-line input.@@ -67,7 +69,7 @@ fun RecipientChipField( value = text, onValueChange = { text = it }, label = { Text(label) },- placeholder = { Text("Type address, Enter to add") },+ placeholder = { Text(stringResource(R.string.recipient_type_address)) }, modifier = Modifier.fillMaxWidth(), singleLine = true, keyboardOptions = KeyboardOptions(
securemail/src/main/java/com/vayunmathur/securemail/ui/SettingsScreen.kt
diff --git a/securemail/src/main/java/com/vayunmathur/securemail/ui/SettingsScreen.kt b/securemail/src/main/java/com/vayunmathur/securemail/ui/SettingsScreen.ktindex dce522f4b6..40f1cb2a4b 100644--- a/securemail/src/main/java/com/vayunmathur/securemail/ui/SettingsScreen.kt+++ b/securemail/src/main/java/com/vayunmathur/securemail/ui/SettingsScreen.kt@@ -15,6 +15,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.Button@@ -28,6 +29,8 @@ import com.vayunmathur.library.ui.OutlinedTextField import com.vayunmathur.library.ui.Switch import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.rememberMessenger+import com.vayunmathur.library.ui.R as UiR+import com.vayunmathur.securemail.R import com.vayunmathur.securemail.data.MailIdentity import com.vayunmathur.securemail.platform.MailUiState @@ -46,7 +49,7 @@ fun SettingsScreen( val context = LocalContext.current ConsumeMessage(state.message, messenger, onDismissMessages) var newLabel by remember { mutableStateOf("") }- AppScaffold(title = "Settings") { padding ->+ AppScaffold(title = stringResource(UiR.string.settings)) { padding -> DesktopMaxWidthContainer(Modifier.padding(padding)) { Column( modifier = Modifier@@ -61,9 +64,9 @@ fun SettingsScreen( modifier = Modifier.padding(16.dp).fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(8.dp), ) {- Text("Addresses", style = MaterialTheme.typography.titleMedium)+ Text(stringResource(R.string.settings_addresses), style = MaterialTheme.typography.titleMedium) Text(- "Mail to any address lands in this inbox, and you can send from any of them.",+ stringResource(R.string.settings_addresses_explainer), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.secondary, )@@ -77,7 +80,7 @@ fun SettingsScreen( OutlinedTextField( value = newLabel, onValueChange = { newLabel = it },- label = { Text("Label for new alias (optional)") },+ label = { Text(stringResource(R.string.settings_alias_label)) }, singleLine = true, modifier = Modifier.fillMaxWidth(), )@@ -91,21 +94,21 @@ fun SettingsScreen( ) { Text( when {- state.busy -> "Creating…"- !state.socketConnected -> "Relay offline"- else -> "New random alias"+ state.busy -> stringResource(R.string.settings_creating)+ !state.socketConnected -> stringResource(R.string.settings_relay_offline)+ else -> stringResource(R.string.settings_new_random_alias) }, ) } Text(- if (state.socketConnected) "Relay: connected" else "Relay: offline",+ stringResource(R.string.settings_relay_format, if (state.socketConnected) stringResource(R.string.settings_relay_connected) else stringResource(R.string.settings_relay_offline_word)), style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.secondary, ) } } Button(onClick = onExportPublicKey, modifier = Modifier.fillMaxWidth()) {- Text("Show public key")+ Text(stringResource(R.string.settings_show_public_key)) } state.exportArmor?.let { armor -> Card(modifier = Modifier.fillMaxWidth()) {@@ -117,7 +120,7 @@ fun SettingsScreen( } } Button(onClick = onForget, modifier = Modifier.fillMaxWidth()) {- Text("Forget identity on this device")+ Text(stringResource(R.string.settings_forget_identity)) } } }@@ -137,15 +140,15 @@ private fun AddressRow( ) { Column(Modifier.weight(1f)) { val title = when {- identity.isPrimary -> "Primary"+ identity.isPrimary -> stringResource(R.string.identity_primary) identity.label.isNotBlank() -> identity.label- else -> "Alias"+ else -> stringResource(R.string.settings_alias) } Text(title, style = MaterialTheme.typography.labelMedium) Text(identity.address, style = MaterialTheme.typography.bodyMedium) Text(- "Key: ${identity.fingerprintHex.take(16)}…" +- if (identity.disabled) " · disabled, mail held" else "",+ stringResource(R.string.settings_key_format, identity.fingerprintHex.take(16)) ++ if (identity.disabled) stringResource(R.string.settings_disabled_suffix) else "", style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.secondary, )
securemail/src/main/res/values/strings.xml
diff --git a/securemail/src/main/res/values/strings.xml b/securemail/src/main/res/values/strings.xmlindex f00c7d3320..072eb1a742 100644--- a/securemail/src/main/res/values/strings.xml+++ b/securemail/src/main/res/values/strings.xml@@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <resources>+ <!-- App name displayed in launcher --> <string name="app_name">SecureMail</string> <!-- Outbox row: send attempt count. %1$d = number of attempts --> <plurals name="outbox_tries">@@ -11,4 +12,191 @@ <item quantity="one">Moved to Trash</item> <item quantity="other">%1$d moved to Trash</item> </plurals>++ <!-- ComposeScreen: snackbar when a picked contact address is invalid or already added. Sentence. -->+ <string name="compose_invalid_or_duplicate_address">Invalid or duplicate address.</string>+ <!-- ComposeScreen: snackbar when a typed recipient address is invalid. Sentence. Reused for To/Cc/Bcc. -->+ <string name="compose_enter_valid_email">Enter a valid email address.</string>+ <!-- RecipientChipField: label for the To recipient field. Noun. Also ReaderScreen details To row. -->+ <string name="to_label">To</string>+ <!-- ComposeScreen: label for the Cc recipient field. Abbreviation. -->+ <string name="compose_cc">Cc</string>+ <!-- ComposeScreen: label for the Bcc recipient field. Abbreviation. -->+ <string name="compose_bcc">Bcc</string>+ <!-- ComposeScreen: label for the subject field. Noun. -->+ <string name="compose_subject">Subject</string>+ <!-- ComposeScreen: label for the body field. Noun. ReaderScreen: fallback app-bar title. -->+ <string name="message_label">Message</string>+ <!-- ComposeScreen: Send button label while sending. Verb, progressive. -->+ <string name="compose_sending">Sending…</string>+ <!-- ComposeScreen: Send button label. Verb. -->+ <string name="compose_send">Send</string>+ <!-- ComposeScreen: Discard button label. Verb. -->+ <string name="compose_discard">Discard</string>+ <!-- ComposeScreen: From picker showing the sending address. %1$s is the address. -->+ <string name="compose_from_format">From: %1$s</string>+ <!-- Identity label for the primary address. Noun. Used in ComposeScreen From picker and SettingsScreen. -->+ <string name="identity_primary">Primary</string>++ <!-- InboxScreen: ErrorState title when loading fails. Sentence fragment. -->+ <string name="inbox_something_went_wrong">Something went wrong</string>+ <!-- InboxScreen: button to delete all Trash messages. Verb phrase. -->+ <string name="inbox_empty_trash">Empty trash</string>+ <!-- InboxScreen: confirm dialog title when emptying Trash. Question. -->+ <string name="inbox_empty_trash_title">Empty trash?</string>+ <!-- InboxScreen: confirm dialog title when deleting selected Trash messages forever. Question. -->+ <string name="inbox_delete_forever_title">Delete forever?</string>+ <!-- InboxScreen: confirm dialog body for permanent deletion. Singular has no count; plural %1$d is the message count. -->+ <plurals name="inbox_permanent_delete_message">+ <item quantity="one">This message will be permanently deleted from this device.</item>+ <item quantity="other">%1$d messages will be permanently deleted from this device.</item>+ </plurals>+ <!-- InboxScreen: selection bar title. %1$d is the selected count. -->+ <string name="inbox_selected_format">%1$d selected</string>+ <!-- InboxScreen: empty Inbox state. Sentences. -->+ <string name="inbox_empty_inbox">No mail yet. Share your address to receive encrypted mail.</string>+ <!-- Empty Sent state. Sentence. Used in InboxScreen and OutScreen. -->+ <string name="empty_nothing_sent">Nothing sent yet.</string>+ <!-- Empty Drafts state. Sentence. Used in InboxScreen and OutScreen. -->+ <string name="empty_no_drafts">No drafts.</string>+ <!-- InboxScreen: empty Spam state. Sentences. -->+ <string name="inbox_empty_spam">No spam. Verification failures land here.</string>+ <!-- InboxScreen: empty Trash state. Sentence. -->+ <string name="inbox_empty_trash_state">Trash is empty.</string>++ <!-- LockScreen: app-bar title while locked. Noun phrase. -->+ <string name="lock_title">SecureMail locked</string>+ <!-- LockScreen: card heading. Sentence fragment. -->+ <string name="lock_unlock_to_read">Unlock to read your mail</string>+ <!-- LockScreen: explainer that the PGP private key is sealed until authentication. Sentence. -->+ <string name="lock_pgp_explainer">Your PGP private key is sealed until you authenticate.</string>+ <!-- LockScreen: Unlock button. Verb. -->+ <string name="lock_unlock">Unlock</string>++ <!-- MailBottomBar: Inbox tab label. Noun. -->+ <string name="tab_inbox">Inbox</string>+ <!-- MailBottomBar: Spam tab label. Noun. -->+ <string name="tab_spam">Spam</string>+ <!-- MailBottomBar: Out tab label (Drafts/Outbox/Sent). Noun. -->+ <string name="tab_out">Out</string>+ <!-- MailBottomBar: Trash tab label. Noun. -->+ <string name="tab_trash">Trash</string>++ <!-- MessageBodyView: banner when remote content is blocked. Sentence fragment. -->+ <string name="body_remote_content_blocked">Remote content blocked</string>+ <!-- MessageBodyView: button to load remote content. Verb. -->+ <string name="body_load">Load</string>+ <!-- MessageBodyView: button to hide quoted text. Verb phrase. -->+ <string name="body_hide_quoted">Hide quoted text</string>+ <!-- MessageBodyView: button to show quoted text. Verb phrase. -->+ <string name="body_show_quoted">Show quoted text</string>+ <!-- MessageBodyView: placeholder body while decrypting. Parenthesised, progressive. -->+ <string name="body_decrypting">(decrypting…)</string>++ <!-- Message row/reader: placeholder subject when none. Parenthesised noun phrase. -->+ <string name="no_subject">(no subject)</string>+ <!-- MessageRow: placeholder subject for an encrypted message. Noun phrase. -->+ <string name="message_encrypted">Encrypted message</string>+ <!-- Message row/outbox/draft: recipient line. %1$s is the recipient list. -->+ <string name="message_to_format">To: %1$s</string>+ <!-- Placeholder when an address is unknown. Parenthesised adjective. -->+ <string name="unknown_parenthesized">(unknown)</string>+ <!-- Placeholder when the sender is encrypted. Parenthesised noun phrase. -->+ <string name="encrypted_sender_parenthesized">(encrypted sender)</string>+ <!-- MessageRow: preview placeholder prompting to open an encrypted message. Verb phrase. -->+ <string name="message_open_to_decrypt">Open to decrypt</string>++ <!-- NavigationEntries: reply subject prefix. %1$s is the original subject. -->+ <string name="reply_subject_format">Re: %1$s</string>+ <!-- NavigationEntries: snackbar after saving a draft. Sentence fragment. -->+ <string name="draft_saved">Draft saved</string>++ <!-- OnboardingScreen: app-bar title. Verb phrase. -->+ <string name="onboarding_title">Set up SecureMail</string>+ <!-- OnboardingScreen: explainer for claiming an address and generating a PGP key. Sentences. -->+ <string name="onboarding_claim_explainer">Claim an @maemail.org address. A PGP key (Ed25519 + X25519) is generated on this device — the private key never leaves it.</string>+ <!-- OnboardingScreen: address section heading. Noun phrase. -->+ <string name="onboarding_your_address">Your address</string>+ <!-- OnboardingScreen: address field label showing the resulting address format. -->+ <string name="onboarding_address_label">name (→ [email protected])</string>+ <!-- OnboardingScreen: passphrase field label with minimum length. Noun phrase. -->+ <string name="onboarding_passphrase_label">Key passphrase (min 8 chars)</string>+ <!-- OnboardingScreen: claim button label while generating. Verb, progressive. -->+ <string name="onboarding_generating">Generating…</string>+ <!-- OnboardingScreen: claim button label. Verb phrase. -->+ <string name="onboarding_claim">Claim address + generate key</string>++ <!-- OutScreen: Drafts section title. Noun, plural. -->+ <string name="out_drafts">Drafts</string>+ <!-- OutScreen: snackbar after deleting a draft. Sentence fragment. -->+ <string name="out_draft_deleted">Draft deleted</string>+ <!-- OutScreen: Outbox section title. Noun. -->+ <string name="out_outbox">Outbox</string>+ <!-- OutScreen: empty Outbox state. Sentence. -->+ <string name="out_nothing_waiting">Nothing waiting to send.</string>+ <!-- OutScreen: button to retry all queued sends. Verb phrase. -->+ <string name="out_retry_all">Retry all</string>+ <!-- OutScreen: Sent section title. Verb participle. -->+ <string name="out_sent">Sent</string>+ <!-- OutScreen: draft recipient placeholder when there are no recipients. Noun phrase. -->+ <string name="out_no_recipients">No recipients</string>++ <!-- ReaderScreen: placeholder when the message is missing. Sentence. -->+ <string name="reader_not_found">Message not found.</string>+ <!-- ReaderScreen: date shown after the sender, separated by a bullet. %1$s is the formatted date. -->+ <string name="reader_date_separator_format"> • %1$s</string>+ <!-- ReaderScreen: label for a sent message counterpart. Adverb phrase. -->+ <string name="reader_from_me">from me</string>+ <!-- ReaderScreen: label for a received message counterpart. Adverb phrase. -->+ <string name="reader_to_me">to me</string>+ <!-- ReaderScreen: Reply button. Verb. -->+ <string name="reader_reply">Reply</string>+ <!-- ReaderScreen: details From row label. Adverb. -->+ <string name="from_label">From</string>+ <!-- ReaderScreen: details signer heading. Noun phrase. -->+ <string name="reader_signer_fingerprint">Signer fingerprint</string>+ <!-- ReaderScreen: trust line for a sent unencrypted message. Sentence fragment. -->+ <string name="reader_sent_unencrypted">Sent unencrypted · no key for a recipient</string>+ <!-- ReaderScreen: trust line for a sent encrypted message. Sentence fragment. -->+ <string name="reader_sent_encrypted">Sent encrypted</string>+ <!-- ReaderScreen: trust line for an unencrypted message. Sentence fragment. -->+ <string name="reader_not_encrypted">Not encrypted</string>+ <!-- ReaderScreen: trust line for a verified encrypted message. Sentence fragment. -->+ <string name="reader_encrypted_verified">Encrypted · signature verified</string>+ <!-- ReaderScreen: trust line for an unverified encrypted message. Sentence fragment. -->+ <string name="reader_encrypted_not_verified">Encrypted · signature not verified</string>+ <!-- ReaderScreen: trust line while locked/decrypting. Sentence fragment, progressive. -->+ <string name="reader_locked_decrypting">Locked · decrypting…</string>++ <!-- RecipientChipField: input placeholder. Instruction. -->+ <string name="recipient_type_address">Type address, Enter to add</string>++ <!-- SettingsScreen: Addresses section heading. Noun, plural. -->+ <string name="settings_addresses">Addresses</string>+ <!-- SettingsScreen: explainer under Addresses. Sentence. -->+ <string name="settings_addresses_explainer">Mail to any address lands in this inbox, and you can send from any of them.</string>+ <!-- SettingsScreen: label for the optional new-alias label field. Noun phrase. -->+ <string name="settings_alias_label">Label for new alias (optional)</string>+ <!-- SettingsScreen: new-alias button label while creating. Verb, progressive. -->+ <string name="settings_creating">Creating…</string>+ <!-- SettingsScreen: new-alias button label when the relay is offline. Noun phrase. -->+ <string name="settings_relay_offline">Relay offline</string>+ <!-- SettingsScreen: new-alias button label. Noun phrase. -->+ <string name="settings_new_random_alias">New random alias</string>+ <!-- SettingsScreen: relay status line. %1$s is connected or offline. -->+ <string name="settings_relay_format">Relay: %1$s</string>+ <!-- SettingsScreen: relay connected status word used in settings_relay_format. Adjective. -->+ <string name="settings_relay_connected">connected</string>+ <!-- SettingsScreen: relay offline status word used in settings_relay_format. Adjective. -->+ <string name="settings_relay_offline_word">offline</string>+ <!-- SettingsScreen: button to show the public key. Verb phrase. -->+ <string name="settings_show_public_key">Show public key</string>+ <!-- SettingsScreen: button to forget the identity on this device. Verb phrase. -->+ <string name="settings_forget_identity">Forget identity on this device</string>+ <!-- SettingsScreen: alias title when no label is set. Noun. -->+ <string name="settings_alias">Alias</string>+ <!-- SettingsScreen: key fingerprint line. %1$s is the truncated fingerprint. -->+ <string name="settings_key_format">Key: %1$s…</string>+ <!-- SettingsScreen: suffix on the key line for a disabled identity. Sentence fragment. -->+ <string name="settings_disabled_suffix"> · disabled, mail held</string> </resources>
shop/src/main/java/com/vayunmathur/shop/ui/CartScreen.kt
diff --git a/shop/src/main/java/com/vayunmathur/shop/ui/CartScreen.kt b/shop/src/main/java/com/vayunmathur/shop/ui/CartScreen.ktindex e6735108e2..1ae7b4974b 100644--- a/shop/src/main/java/com/vayunmathur/shop/ui/CartScreen.kt+++ b/shop/src/main/java/com/vayunmathur/shop/ui/CartScreen.kt@@ -34,6 +34,7 @@ import com.vayunmathur.library.ui.IconShoppingCart import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.rememberMessenger+import com.vayunmathur.library.ui.R as UiR import com.vayunmathur.library.util.AppMessages import com.vayunmathur.shop.R import com.vayunmathur.shop.data.CartLine@@ -106,7 +107,7 @@ internal fun CartContent( byShop.forEach { (store, lines) -> item(key = "header-${store.first}|${store.second}") { Text(- lines.first().displayName.ifBlank { "Unknown store" },+ lines.first().displayName.ifBlank { stringResource(R.string.unknown_store) }, style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.onSurfaceVariant, )@@ -121,7 +122,13 @@ internal fun CartContent( modifier = Modifier.fillMaxWidth(), ) { if (startingStore == store) CircularProgressIndicator(Modifier.size(20.dp))- else Text(if (byShop.size > 1) "Checkout with ${lines.first().displayName}" else stringResource(R.string.checkout))+ else Text(+ if (byShop.size > 1) {+ stringResource(R.string.checkout_with_store, lines.first().displayName)+ } else {+ stringResource(R.string.checkout)+ },+ ) } } }@@ -156,12 +163,12 @@ private fun CartRow(line: CartLine, onRemove: () -> Unit) { ) } Text(- "${MoneyFormat.format(line.unitPrice)} × ${line.quantity}",+ stringResource(R.string.price_times_quantity, MoneyFormat.format(line.unitPrice), line.quantity), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.primary, ) }- Button(onClick = onRemove) { Text("Remove") }+ Button(onClick = onRemove) { Text(stringResource(UiR.string.remove)) } } } }@@ -193,7 +200,7 @@ private fun CartFooter(cart: List<CartLine>) { */ fun openContinueUrl(context: Context, url: String) { if (com.vayunmathur.shop.domain.MerchantUrls.httpsUrl(url) == null) {- AppMessages.show("Payment link is missing. Please try again.")+ AppMessages.show(context.getString(R.string.payment_link_missing)) return } runCatching {@@ -212,7 +219,7 @@ fun openContinueUrl(context: Context, url: String) { ).addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK) context.startActivity(view) }.onFailure {- AppMessages.show("No app can open the payment page.")+ AppMessages.show(context.getString(R.string.payment_page_no_app)) } } }
shop/src/main/java/com/vayunmathur/shop/ui/EmbeddedCheckoutScreen.kt
diff --git a/shop/src/main/java/com/vayunmathur/shop/ui/EmbeddedCheckoutScreen.kt b/shop/src/main/java/com/vayunmathur/shop/ui/EmbeddedCheckoutScreen.ktindex 19455c6f38..f44cab4e34 100644--- a/shop/src/main/java/com/vayunmathur/shop/ui/EmbeddedCheckoutScreen.kt+++ b/shop/src/main/java/com/vayunmathur/shop/ui/EmbeddedCheckoutScreen.kt@@ -26,6 +26,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.viewinterop.AndroidView import androidx.webkit.WebSettingsCompat@@ -36,6 +37,7 @@ import com.vayunmathur.library.ui.Button import com.vayunmathur.library.ui.CircularProgressIndicator import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.rememberMessenger+import com.vayunmathur.shop.R import com.vayunmathur.shop.data.EmbeddedCheckoutRequest import com.vayunmathur.shop.domain.EcAction import com.vayunmathur.shop.domain.EmbeddedCheckout@@ -67,6 +69,8 @@ fun EmbeddedCheckoutScreen(viewModel: ShopViewModel, onClose: () -> Unit) { } val context = LocalContext.current val messenger = rememberMessenger()+ // Captured at composition: the completion callback fires outside composition.+ val orderPlacedMessage = stringResource(R.string.order_placed_with_store, request.storeName) var loading by remember { mutableStateOf(true) } var failed by remember { mutableStateOf(false) } var webView by remember { mutableStateOf<WebView?>(null) }@@ -91,8 +95,10 @@ fun EmbeddedCheckoutScreen(viewModel: ShopViewModel, onClose: () -> Unit) { verticalArrangement = Arrangement.spacedBy(12.dp), horizontalAlignment = Alignment.CenterHorizontally, ) {- Text("The store's checkout didn't load.")- Button(onClick = { openContinueUrl(context, request.browserUrl) }) { Text("Open in browser") }+ Text(stringResource(R.string.checkout_load_failed))+ Button(onClick = { openContinueUrl(context, request.browserUrl) }) {+ Text(stringResource(R.string.open_in_browser))+ } } } else { CheckoutWebView(@@ -109,7 +115,7 @@ fun EmbeddedCheckoutScreen(viewModel: ShopViewModel, onClose: () -> Unit) { } is EcAction.Completed -> { viewModel.embeddedCheckoutCompleted(action.orderId, action.permalinkUrl, action.totalMinor, context)- messenger.show("Order placed with ${request.storeName}")+ messenger.show(orderPlacedMessage) close() } is EcAction.Failed -> messenger.show(action.message)
shop/src/main/java/com/vayunmathur/shop/ui/OrdersScreen.kt
diff --git a/shop/src/main/java/com/vayunmathur/shop/ui/OrdersScreen.kt b/shop/src/main/java/com/vayunmathur/shop/ui/OrdersScreen.ktindex a7018d616a..60a8737d98 100644--- a/shop/src/main/java/com/vayunmathur/shop/ui/OrdersScreen.kt+++ b/shop/src/main/java/com/vayunmathur/shop/ui/OrdersScreen.kt@@ -93,7 +93,11 @@ private fun OrderRow(order: PlacedOrder, onOpen: (String) -> Unit) { tracking?.label?.let { Text(it, style = MaterialTheme.typography.labelMedium) } } Text(- "${pluralStringResource(R.plurals.order_items, order.itemCount, order.itemCount)} · ${MoneyFormat.format(order.total)}",+ stringResource(+ R.string.order_summary_format,+ pluralStringResource(R.plurals.order_items, order.itemCount, order.itemCount),+ MoneyFormat.format(order.total),+ ), style = MaterialTheme.typography.bodySmall, ) Text(
shop/src/main/java/com/vayunmathur/shop/ui/ProductScreen.kt
diff --git a/shop/src/main/java/com/vayunmathur/shop/ui/ProductScreen.kt b/shop/src/main/java/com/vayunmathur/shop/ui/ProductScreen.ktindex 7654bd1198..83725989e6 100644--- a/shop/src/main/java/com/vayunmathur/shop/ui/ProductScreen.kt+++ b/shop/src/main/java/com/vayunmathur/shop/ui/ProductScreen.kt@@ -41,6 +41,7 @@ import com.vayunmathur.library.ui.DetailSection import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.rememberMessenger+import com.vayunmathur.library.ui.R as UiR import com.vayunmathur.shop.R import com.vayunmathur.shop.data.CatalogOptionSelection import com.vayunmathur.shop.data.ProductVariant@@ -70,6 +71,11 @@ fun ProductScreen( val dark = isSystemInDarkTheme() val context = LocalContext.current val messenger = rememberMessenger()+ // Captured at composition: refresh failures are set inside LaunchedEffect.+ val domainMissingMessage = stringResource(R.string.product_domain_missing)+ val variantMissingMessage = stringResource(R.string.product_variant_missing)+ val refreshFailedMessage = stringResource(R.string.product_refresh_failed)+ val addedToCartMessage = stringResource(R.string.added_to_cart) var product by remember(variantId, platformId, shopDomain) { mutableStateOf((viewModel.results + viewModel.linkedProducts).firstOrNull { candidate -> candidate.platformId == platformId && candidate.variants.any {@@ -100,7 +106,7 @@ fun ProductScreen( ?: snapshot?.takeIf { it.shopDomain == publisherDomain }?.storeName.orEmpty() try { if (publisherDomain.isBlank()) {- failure = "The publishing store domain is missing. Cart actions are disabled."+ failure = domainMissingMessage } else { AppInit.awaitReady() backend.getProduct(@@ -109,7 +115,7 @@ fun ProductScreen( ).fold( onSuccess = { live -> if (live.variants.none { it.id == selectedVariant }) {- failure = "The store no longer lists this exact variant. Cart actions are disabled."+ failure = variantMissingMessage } else { // Detail responses can narrow to one option. Other choices stay unverified until selected. val choices = snapshot?.variants?.map { previous ->@@ -131,7 +137,7 @@ fun ProductScreen( onFailure = { error -> if (error is CancellationException) throw error failure = (error as? ShopBackendException)?.error?.message()- ?: "Couldn't refresh this product from the publishing store. Check your connection and retry."+ ?: refreshFailedMessage }, ) }@@ -139,7 +145,7 @@ fun ProductScreen( throw error } catch (error: Exception) { failure = (error as? ShopBackendException)?.error?.message()- ?: "Couldn't refresh this product from the publishing store. Check your connection and retry."+ ?: refreshFailedMessage } finally { refreshing = false }@@ -166,10 +172,10 @@ fun ProductScreen( Column(horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(12.dp)) { if (loading) { CircularProgressIndicator()- Text("Checking live price and availability...")+ Text(stringResource(R.string.product_checking)) } else {- Text(failure ?: "This product is unavailable. Please retry.")- Button(onClick = { retry += 1 }) { Text("Retry") }+ Text(failure ?: stringResource(R.string.product_unavailable))+ Button(onClick = { retry += 1 }) { Text(stringResource(UiR.string.retry)) } } } }@@ -184,7 +190,7 @@ fun ProductScreen( onSelectVariant = { selectedVariant = it }, onQuantityChange = { quantity = it }, onRetry = { retry += 1 },- onAddToCart = { if (canAdd) { addToCart(); messenger.show("Added to cart") } },+ onAddToCart = { if (canAdd) { addToCart(); messenger.show(addedToCartMessage) } }, onBuyNow = { addToCart()?.let { (store, shop) -> viewModel.checkoutStore(store, shop, context, dark, onReady = onPayInApp, onError = messenger::show)@@ -252,14 +258,17 @@ internal fun ProductDetailContent( } } item {- DetailSection("Store") {- Text(storeName.ifBlank { storeDomain.ifBlank { "Store" } }, style = MaterialTheme.typography.titleMedium)+ DetailSection(stringResource(R.string.store_label)) {+ Text(+ storeName.ifBlank { storeDomain.ifBlank { stringResource(R.string.store_label) } },+ style = MaterialTheme.typography.titleMedium,+ ) } } item {- DetailSection("Price") {+ DetailSection(stringResource(R.string.price_label)) { Text(- variant?.price?.let { MoneyFormat.format(it) } ?: "Select an option to see its price",+ variant?.price?.let { MoneyFormat.format(it) } ?: stringResource(R.string.select_option_price), style = MaterialTheme.typography.headlineSmall, color = MaterialTheme.colorScheme.primary, )@@ -267,7 +276,7 @@ internal fun ProductDetailContent( } if (product.variants.size > 1) { item {- DetailSection("Options") {+ DetailSection(stringResource(R.string.options_label)) { VariantPicker(product.variants, selectedVariantId, onSelectVariant) } }@@ -276,12 +285,12 @@ internal fun ProductDetailContent( item { Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { when {- loading -> Text("Checking live price and availability...")+ loading -> Text(stringResource(R.string.product_checking)) !verified -> {- Text(failure ?: "Live price and availability are not verified. Cart actions are disabled.")- Button(onClick = onRetry) { Text("Retry") }+ Text(failure ?: stringResource(R.string.product_not_verified))+ Button(onClick = onRetry) { Text(stringResource(UiR.string.retry)) } }- variant?.available != true -> Text("This variant is out of stock.")+ variant?.available != true -> Text(stringResource(R.string.product_variant_out_of_stock)) } Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) { Button(onClick = onAddToCart, enabled = canAdd, modifier = Modifier.weight(1f)) {@@ -293,9 +302,9 @@ internal fun ProductDetailContent( } } if ((!product.checkoutEligible || !verified && !loading) && MerchantUrls.httpsUrl(product.url) != null) {- Button(onClick = { onOpenUrl(product.url) }) { Text("View on merchant site") }+ Button(onClick = { onOpenUrl(product.url) }) { Text(stringResource(R.string.view_on_merchant_site)) } Text(- "Completes on the merchant site.",+ stringResource(R.string.completes_on_merchant_site), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant, )@@ -304,7 +313,7 @@ internal fun ProductDetailContent( } if (description.isNotBlank()) { item {- DetailSection("Details") {+ DetailSection(stringResource(R.string.details_label)) { Text(description, style = MaterialTheme.typography.bodyMedium) } }
shop/src/main/java/com/vayunmathur/shop/ui/ProfileScreen.kt
diff --git a/shop/src/main/java/com/vayunmathur/shop/ui/ProfileScreen.kt b/shop/src/main/java/com/vayunmathur/shop/ui/ProfileScreen.ktindex 3087980f2b..b02f54c5c9 100644--- a/shop/src/main/java/com/vayunmathur/shop/ui/ProfileScreen.kt+++ b/shop/src/main/java/com/vayunmathur/shop/ui/ProfileScreen.kt@@ -14,6 +14,7 @@ import androidx.compose.runtime.saveable.listSaver import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runti
Diff truncated.