Skip to content

Your phone, on your command. Gotcha is world's first fully on-device AI copilot for Android that turns natural language into real device actions — safely.

refactor(i18n): settings home, page titles and search in string resources

Durganshu9f7312fcbf2a
diff --git a/app/src/main/java/com/gotcha/ui/AboutScreen.kt b/app/src/main/java/com/gotcha/ui/AboutScreen.kt
index afba166..e29364c 100644
--- a/app/src/main/java/com/gotcha/ui/AboutScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/AboutScreen.kt
@@ -23,6 +23,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.unit.dp
import androidx.lifecycle.Lifecycle
@@ -46,7 +47,7 @@ fun AboutScreen(
) {
val overlay = rememberSettingsOverlayState()
- SettingsScaffold(title = SettingsPage.ABOUT.title, onBack = onBack, overlay = overlay) {
+ SettingsScaffold(title = stringResource(SettingsPage.ABOUT.title), onBack = onBack, overlay = overlay) {
listOf(SettingsPage.ABOUT_SAMOSA, SettingsPage.LEGAL).forEach { page ->
HorizontalDivider(thickness = 1.dp)
SettingsNavRow(
@@ -83,7 +84,7 @@ fun AboutSamosaScreen(
aboutText = readAsset(context, CompanyInfoTool.ABOUT_ASSET)
}
- SettingsScaffold(title = SettingsPage.ABOUT_SAMOSA.title, onBack = onBack, overlay = overlay) {
+ SettingsScaffold(title = stringResource(SettingsPage.ABOUT_SAMOSA.title), onBack = onBack, overlay = overlay) {
Text(
text = renderLegalMarkdown(aboutText ?: "(loading…)"),
style = MaterialTheme.typography.bodyMedium
diff --git a/app/src/main/java/com/gotcha/ui/AiConfigScreen.kt b/app/src/main/java/com/gotcha/ui/AiConfigScreen.kt
index f54c06b..09c9549 100644
--- a/app/src/main/java/com/gotcha/ui/AiConfigScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/AiConfigScreen.kt
@@ -21,6 +21,7 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.text.input.VisualTransformation
@@ -164,7 +165,7 @@ fun AiConfigScreen(
}
}
- SettingsScaffold(title = SettingsPage.AI_CONFIG.title, onBack = onBack, overlay = overlay) {
+ SettingsScaffold(title = stringResource(SettingsPage.AI_CONFIG.title), onBack = onBack, overlay = overlay) {
// ---- Provider / model guidance ----
Text(
"Recommended setup: Use the SAMOSA AI provider for the best LLM performance.\n",
diff --git a/app/src/main/java/com/gotcha/ui/AiHubScreen.kt b/app/src/main/java/com/gotcha/ui/AiHubScreen.kt
index d941fa1..b4d30f1 100644
--- a/app/src/main/java/com/gotcha/ui/AiHubScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/AiHubScreen.kt
@@ -6,6 +6,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.gotcha.ui.tour.TourAnchor
import com.gotcha.ui.tour.tourAnchor
@@ -26,7 +27,7 @@ fun AiHubScreen(
) {
val overlay = rememberSettingsOverlayState()
- SettingsScaffold(title = SettingsPage.AI.title, onBack = onBack, overlay = overlay) {
+ SettingsScaffold(title = stringResource(SettingsPage.AI.title), onBack = onBack, overlay = overlay) {
Text(
"The model does the thinking; speech gives it a voice and ears. " +
"One provider can cover both. Which language it speaks and answers " +
diff --git a/app/src/main/java/com/gotcha/ui/AppearanceScreen.kt b/app/src/main/java/com/gotcha/ui/AppearanceScreen.kt
index 1e4799f..09c357e 100644
--- a/app/src/main/java/com/gotcha/ui/AppearanceScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/AppearanceScreen.kt
@@ -29,6 +29,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
@@ -75,7 +76,7 @@ fun AppearanceScreen(
onApply(load())
}
- SettingsScaffold(title = SettingsPage.APPEARANCE.title, onBack = onBack, overlay = overlay) {
+ SettingsScaffold(title = stringResource(SettingsPage.APPEARANCE.title), onBack = onBack, overlay = overlay) {
Text("Theme", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Bold)
Text(
"Every theme works on every device. Where live blur isn't available, " +
diff --git a/app/src/main/java/com/gotcha/ui/AssistiveBallScreen.kt b/app/src/main/java/com/gotcha/ui/AssistiveBallScreen.kt
index a484b8d..0e4a731 100644
--- a/app/src/main/java/com/gotcha/ui/AssistiveBallScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/AssistiveBallScreen.kt
@@ -29,6 +29,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
@@ -80,7 +81,7 @@ fun AssistiveBallScreen(
}
}
- SettingsScaffold(title = SettingsPage.ASSISTIVE_BALL.title, onBack = onBack, overlay = overlay) {
+ SettingsScaffold(title = stringResource(SettingsPage.ASSISTIVE_BALL.title), onBack = onBack, overlay = overlay) {
SettingsToggleRow(
label = "Show Assistive Ball",
checked = enabled,
diff --git a/app/src/main/java/com/gotcha/ui/LanguageScreen.kt b/app/src/main/java/com/gotcha/ui/LanguageScreen.kt
index 69109c2..3f05b42 100644
--- a/app/src/main/java/com/gotcha/ui/LanguageScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/LanguageScreen.kt
@@ -136,7 +136,7 @@ fun LanguageScreen(
resolvedVoiceLanguage
)
- SettingsScaffold(title = SettingsPage.LANGUAGE.title, onBack = onBack, overlay = overlay) {
+ SettingsScaffold(title = stringResource(SettingsPage.LANGUAGE.title), onBack = onBack, overlay = overlay) {
Text(
stringResource(R.string.language_page_intro),
style = MaterialTheme.typography.bodySmall,
diff --git a/app/src/main/java/com/gotcha/ui/LegalScreen.kt b/app/src/main/java/com/gotcha/ui/LegalScreen.kt
index 6ba21cb..41ceee1 100644
--- a/app/src/main/java/com/gotcha/ui/LegalScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/LegalScreen.kt
@@ -19,6 +19,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
@@ -60,7 +61,7 @@ fun LegalScreen(
privacyText = readAsset(context, "legal/privacy-data-retention.md")
}
- SettingsScaffold(title = SettingsPage.LEGAL.title, onBack = onBack, overlay = overlay) {
+ SettingsScaffold(title = stringResource(SettingsPage.LEGAL.title), onBack = onBack, overlay = overlay) {
Text(
"By using Gotcha you accept these documents.",
style = MaterialTheme.typography.bodyMedium,
diff --git a/app/src/main/java/com/gotcha/ui/NotificationsScreen.kt b/app/src/main/java/com/gotcha/ui/NotificationsScreen.kt
index 1d5a561..2ed916c 100644
--- a/app/src/main/java/com/gotcha/ui/NotificationsScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/NotificationsScreen.kt
@@ -29,6 +29,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.unit.dp
import androidx.core.content.ContextCompat
@@ -89,7 +90,7 @@ fun NotificationsScreen(
if (serverMessagesEnabled) onSyncServerMessages()
}
- SettingsScaffold(title = SettingsPage.NOTIFICATIONS.title, onBack = onBack, overlay = overlay) {
+ SettingsScaffold(title = stringResource(SettingsPage.NOTIFICATIONS.title), onBack = onBack, overlay = overlay) {
Text(
"Played as soon as a reply arrives. Turn both off for no alert.",
style = MaterialTheme.typography.bodySmall
diff --git a/app/src/main/java/com/gotcha/ui/PermissionsScreen.kt b/app/src/main/java/com/gotcha/ui/PermissionsScreen.kt
index 60706c4..0a4711f 100644
--- a/app/src/main/java/com/gotcha/ui/PermissionsScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/PermissionsScreen.kt
@@ -1,6 +1,7 @@
package com.gotcha.ui
import androidx.compose.runtime.Composable
+import androidx.compose.ui.res.stringResource
/**
* The Permissions page. The groups themselves live in [PermissionsSection],
@@ -15,7 +16,7 @@ fun PermissionsScreen(
onOpenTermuxSetup: (() -> Unit)? = null
) {
val overlay = rememberSettingsOverlayState()
- SettingsScaffold(title = SettingsPage.PERMISSIONS.title, onBack = onBack, overlay = overlay) {
+ SettingsScaffold(title = stringResource(SettingsPage.PERMISSIONS.title), onBack = onBack, overlay = overlay) {
PermissionsSection(packageName = packageName, onOpenTermuxSetup = onOpenTermuxSetup)
}
}
diff --git a/app/src/main/java/com/gotcha/ui/PersonalInfoScreen.kt b/app/src/main/java/com/gotcha/ui/PersonalInfoScreen.kt
index dcf37fd..0b086ef 100644
--- a/app/src/main/java/com/gotcha/ui/PersonalInfoScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/PersonalInfoScreen.kt
@@ -17,6 +17,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import com.gotcha.data.Settings
@@ -72,7 +73,7 @@ fun PersonalInfoScreen(
preferredCurrency = preferredCurrency
)
- SettingsScaffold(title = SettingsPage.PERSONAL_INFO.title, onBack = onBack, overlay = overlay) {
+ SettingsScaffold(title = stringResource(SettingsPage.PERSONAL_INFO.title), onBack = onBack, overlay = overlay) {
Text(
"About you",
style = MaterialTheme.typography.titleMedium,
diff --git a/app/src/main/java/com/gotcha/ui/ProactiveScreen.kt b/app/src/main/java/com/gotcha/ui/ProactiveScreen.kt
index a44f70f..1b18fe8 100644
--- a/app/src/main/java/com/gotcha/ui/ProactiveScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/ProactiveScreen.kt
@@ -9,6 +9,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 com.gotcha.data.Settings
/**
@@ -45,7 +46,7 @@ fun ProactiveScreen(
proactiveAutoCopyOtp = proactiveAutoCopyOtp
)
- SettingsScaffold(title = SettingsPage.PROACTIVE.title, onBack = onBack, overlay = overlay) {
+ SettingsScaffold(title = stringResource(SettingsPage.PROACTIVE.title), onBack = onBack, overlay = overlay) {
SettingsToggleRow(
label = "Master Proactive Offers",
checked = proactiveEnabled,
diff --git a/app/src/main/java/com/gotcha/ui/SettingsCommon.kt b/app/src/main/java/com/gotcha/ui/SettingsCommon.kt
index 66615c7..10c2eb8 100644
--- a/app/src/main/java/com/gotcha/ui/SettingsCommon.kt
+++ b/app/src/main/java/com/gotcha/ui/SettingsCommon.kt
@@ -2,6 +2,7 @@ package com.gotcha.ui
import android.content.Intent
import android.net.Uri
+import androidx.annotation.StringRes
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.tween
@@ -59,6 +60,8 @@ import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.layout.positionInRoot
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.res.pluralStringResource
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.SemanticsPropertyKey
import androidx.compose.ui.semantics.SemanticsPropertyReceiver
import androidx.compose.ui.semantics.contentDescription
@@ -67,6 +70,7 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.gotcha.BuildConfig
+import com.gotcha.R
import com.gotcha.auth.ReferralClipboardHelper
import com.gotcha.auth.SamosaTier
import com.gotcha.auth.SamosaUser
@@ -105,8 +109,8 @@ import kotlin.math.round
* collects "who made this app and what did I agree to".
*/
enum class SettingsPage(
- val title: String,
- val summary: String,
+ @StringRes val title: Int,
+ @StringRes val summary: Int,
val testTag: String,
/**
* The page this one is reached from, or null for the home list. Doubles as
@@ -117,83 +121,83 @@ enum class SettingsPage(
val parentPage: () -> SettingsPage? = { null }
) {
PERSONAL_INFO(
- "Personal Info",
- "Who you are, currency, reply style",
+ R.string.settings_page_personal_info,
+ R.string.settings_page_personal_info_summary,
"settings_personal_info_row"
),
LANGUAGE(
- "Language",
- "App display, voice, transcription and AI reply language",
+ R.string.settings_page_language,
+ R.string.settings_page_language_summary,
"settings_language_row"
),
AI(
- "AI",
- "Model, provider, voice and transcription",
+ R.string.settings_page_ai,
+ R.string.settings_page_ai_summary,
"settings_ai_row"
),
AI_CONFIG(
- "AI Configuration",
- "Provider, models, agent limits",
+ R.string.settings_page_ai_config,
+ R.string.settings_page_ai_config_summary,
"settings_ai_config_row",
{ AI }
),
SPEECH(
- "Speech (TTS / STT)",
- "Voices, transcription, read replies aloud",
+ R.string.settings_page_speech,
+ R.string.settings_page_speech_summary,
"settings_speech_row",
{ AI }
),
PERMISSIONS(
- "Permissions",
- "What the assistant is allowed to do",
+ R.string.settings_page_permissions,
+ R.string.settings_page_permissions_summary,
"settings_permissions_row"
),
TERMUX(
- "Termux (Linux shell)",
- "Run commands in a real Linux shell",
+ R.string.settings_page_termux,
+ R.string.settings_page_termux_summary,
"settings_termux_row"
),
SKILLS(
- "Skills / Plugins",
- "Built-in and community skills",
+ R.string.settings_page_skills,
+ R.string.settings_page_skills_summary,
"settings_skills_row"
),
PROACTIVE(
- "Proactive Assistance",
- "Offers, OTP detection, what may be scanned",
+ R.string.settings_page_proactive,
+ R.string.settings_page_proactive_summary,
"settings_proactive_row"
),
ASSISTIVE_BALL(
// The wake word listens from inside the ball's service, so it is not a
// page of its own — the title says so to make it findable.
- "Assistive Ball and Wake Word",
- "Floating ball over other apps, hands-free calls, \"Hey Gotcha\"",
+ R.string.settings_page_assistive_ball,
+ R.string.settings_page_assistive_ball_summary,
"settings_assistive_ball_row"
),
APPEARANCE(
- "Appearance",
- "How the app looks",
+ R.string.settings_page_appearance,
+ R.string.settings_page_appearance_summary,
"settings_appearance_row"
),
NOTIFICATIONS(
- "Notifications",
- "Replies, finished tasks, reminders and tips",
+ R.string.settings_page_notifications,
+ R.string.settings_page_notifications_summary,
"settings_notifications_row"
),
ABOUT(
- "About",
- "Samosa AI, other products, legal, contact",
+ R.string.settings_page_about,
+ R.string.settings_page_about_summary,
"settings_about_row"
),
ABOUT_SAMOSA(
- "About Samosa AI",
- "Mission, products, pricing, developers",
+ R.string.settings_page_about_samosa,
+ R.string.settings_page_about_samosa_summary,
"settings_about_samosa_row",
{ ABOUT }
),
LEGAL(
- "Legal",
- "Terms, disclaimer, data retention",
+ R.string.settings_page_legal,
+ R.string.settings_page_legal_summary,
"settings_legal_row",
{ ABOUT }
);
@@ -214,7 +218,7 @@ fun SettingsNavRow(
onClick: () -> Unit,
modifier: Modifier = Modifier,
/** Overrides the row label. Search results pass the "hub › page" path. */
- title: String = page.title
+ title: String = stringResource(page.title)
) {
Row(
modifier = modifier
@@ -230,7 +234,7 @@ fun SettingsNavRow(
fontWeight = FontWeight.Medium
)
Text(
- text = page.summary,
+ text = stringResource(page.summary),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
@@ -312,7 +316,7 @@ fun SettingsScaffold(
TextButton(
onClick = onBack,
modifier = Modifier.testTag("settings_back")
- ) { Text("← Back") }
+ ) { Text(stringResource(R.string.action_back)) }
}
)
}
@@ -391,21 +395,17 @@ internal fun parseBadgeColor(hex: String): Color = try {
Color(0xFF6C757D)
}
-/** Formats the remaining hours until the referral claim window expires. */
-internal fun formatRemainingClaimHours(
+/** Whole hours left to claim an invite code, or null once the window has closed. */
+internal fun remainingClaimHours(
createdAt: String?,
now: Instant = Instant.now()
-): String? {
+): Long? {
if (createdAt.isNullOrBlank()) return null
return try {
val instant = Instant.parse(createdAt)
val elapsedHours = Duration.between(instant, now).toHours()
val remainingHours = com.gotcha.auth.REFERRAL_CLAIM_WINDOW_HOURS - elapsedHours
- if (remainingHours > 0) {
- "You have ${remainingHours}h left to claim an invite code."
- } else {
- null
- }
+ remainingHours.takeIf { it > 0 }
} catch (_: Exception) {
null
}
@@ -421,7 +421,7 @@ fun TierPill(tier: SamosaTier, modifier: Modifier = Modifier) {
modifier = modifier
) {
Text(
- text = tier.displayName.ifBlank { "Free" },
+ text = tier.displayName.ifBlank { stringResource(R.string.samosa_tier_free) },
color = Color.White,
style = MaterialTheme.typography.labelMedium,
fontWeight = FontWeight.Bold,
@@ -470,13 +470,12 @@ fun ReferAndEarnCard(
verticalArrangement = Arrangement.spacedBy(10.dp)
) {
Text(
- text = "🎁 Invite Friends, Earn Free Credits",
+ text = stringResource(R.string.referral_title),
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.Bold
)
Text(
- text = "Share your invite code — you both get bonus credits when a friend " +
- "signs up with it.",
+ text = stringResource(R.string.referral_description),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
@@ -489,7 +488,7 @@ fun ReferAndEarnCard(
) {
Column {
Text(
- text = "Your invite code:",
+ text = stringResource(R.string.referral_your_code),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
@@ -503,7 +502,7 @@ fun ReferAndEarnCard(
OutlinedButton(
onClick = { ReferralClipboardHelper.copyReferralCode(context, code) }
) {
- Text("Copy Code")
+ Text(stringResource(R.string.referral_copy_code))
}
}
@@ -517,12 +516,17 @@ fun ReferAndEarnCard(
},
modifier = Modifier.fillMaxWidth()
) {
- Text("Share Invite Link")
+ Text(stringResource(R.string.referral_share_link))
}
val earnedCredits = formatScaledCredits(referral.creditsEarned)
Text(
- text = "You've referred ${referral.totalReferred} friends • $earnedCredits credits earned",
+ text = pluralStringResource(
+ R.plurals.referral_stats,
+ referral.totalReferred,
+ referral.totalReferred,
+ earnedCredits
+ ),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
@@ -541,7 +545,7 @@ fun ReferAndEarnCard(
horizontalArrangement = Arrangement.spacedBy(6.dp)
) {
Text(
- text = "🎁 Referred by",
+ text = stringResource(R.string.referral_referred_by),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSecondaryContainer
)
@@ -559,15 +563,19 @@ fun ReferAndEarnCard(
HorizontalDivider(modifier = Modifier.padding(vertical = 4.dp))
Text(
- text = "Enter Invite Code",
+ text = stringResource(R.string.referral_enter_code),
style = MaterialTheme.typography.bodyMedium,
fontWeight = FontWeight.SemiBold
)
- val remainingText = formatRemainingClaimHours(user.createdAt)
- if (remainingText != null) {
+ val remainingHours = remainingClaimHours(user.createdAt)
+ if (remainingHours != null) {
Text(
- text = remainingText,
+ text = pluralStringResource(
+ R.plurals.referral_claim_hours_left,
+ remainingHours.toInt(),
+ remainingHours
+ ),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
@@ -581,7 +589,7 @@ fun ReferAndEarnCard(
OutlinedTextField(
value = claimInput,
onValueChange = { claimInput = it.uppercase().trim() },
- placeholder = { Text("AIR-XXXXXX") },
+ placeholder = { Text(stringResource(R.string.referral_code_placeholder)) },
singleLine = true,
enabled = !referralBusy,
modifier = Modifier.weight(1f)
@@ -598,7 +606,7 @@ fun ReferAndEarnCard(
color = MaterialTheme.colorScheme.onPrimary
)
} else {
- Text("Apply")
+ Text(stringResource(R.string.referral_apply))
}
}
}
@@ -655,13 +663,12 @@ fun InfluencerProgramCard(email: String = "", isInfluencer: Boolean = false, mod
verticalArrangement = Arrangement.spacedBy(10.dp)
) {
Text(
- text = "🌟 Got an audience? Let's team up",
+ text = stringResource(R.string.influencer_title),
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.Bold
)
Text(
- text = "If you're an influencer with a solid following, we'd love to get " +
- "Samosa AI in your hands early — with perks to match.",
+ text = stringResource(R.string.influencer_description),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
@@ -676,7 +683,7 @@ fun InfluencerProgramCard(email: String = "", isInfluencer: Boolean = false, mod
},
modifier = Modifier.fillMaxWidth()
) {
- Text("Apply as an Influencer")
+ Text(stringResource(R.string.influencer_apply))
}
}
}
@@ -707,7 +714,7 @@ fun SamosaAuthSection(
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
Text(
- text = if (signedIn) "Signed in to Samosa AI" else "Not signed in",
+ text = stringResource(if (signedIn) R.string.samosa_signed_in else R.string.samosa_not_signed_in),
style = MaterialTheme.typography.bodyLarge,
fontWeight = FontWeight.Medium
)
@@ -735,14 +742,13 @@ fun SamosaAuthSection(
}
if (signedIn && creditsRemaining != null) {
Text(
- text = "Credits remaining: ${formatScaledCredits(creditsRemaining)}",
+ text = stringResource(R.string.samosa_credits_remaining, formatScaledCredits(creditsRemaining)),
style = MaterialTheme.typography.bodyMedium
)
}
if (!signedIn) {
Text(
- text = "Sign in with Google to use Samosa AI. Your OpenAI-compatible " +
- "settings are kept separately and are unaffected.",
+ text = stringResource(R.string.samosa_sign_in_hint),
style = MaterialTheme.typography.bodySmall
)
}
@@ -751,7 +757,7 @@ fun SamosaAuthSection(
onClick = onSignOut,
enabled = !busy,
modifier = Modifier.fillMaxWidth()
- ) { Text(if (busy) "Please wait…" else "Log out") }
+ ) { Text(stringResource(if (busy) R.string.samosa_please_wait else R.string.samosa_log_out)) }
if (user != null) {
ReferAndEarnCard(
@@ -773,7 +779,7 @@ fun SamosaAuthSection(
modifier = Modifier
.fillMaxWidth()
.then(signInModifier)
- ) { Text(if (busy) "Signing in…" else "Sign in with Google") }
+ ) { Text(stringResource(if (busy) R.string.samosa_signing_in else R.string.samosa_sign_in)) }
}
}
}
@@ -897,7 +903,7 @@ fun Modifier.settingsField(tag: String): Modifier = testTag(tag).settingsHighlig
@Composable
fun SettingsAdvancedSection(
testTag: String,
- title: String = "Advanced settings",
+ title: String = stringResource(R.string.settings_advanced),
content: @Composable ColumnScope.() -> Unit
) {
val holdsHighlight = LocalSettingsHighlight.current.field?.section == testTag
@@ -993,12 +999,12 @@ fun SettingsToggleRow(
}
/** Always produce a human-readable error string for a community-skill import failure. */
-fun formatImportError(t: Throwable): String {
+fun formatImportError(t: Throwable, text: StringLookup): String {
val msg = t.message?.takeIf { it.isNotBlank() }
val causeMsg = t.cause?.message?.takeIf { it.isNotBlank() }
return when {
- !msg.isNullOrBlank() -> "Import failed: $msg"
- !causeMsg.isNullOrBlank() -> "Import failed: $causeMsg"
- else -> "Import failed: ${t::class.java.simpleName}"
- }
+ !msg.isNullOrBlank() -> msg
+ !causeMsg.isNullOrBlank() -> causeMsg
+ else -> t::class.java.simpleName
+ }.let { text(R.string.settings_import_failed, it) }
}
diff --git a/app/src/main/java/com/gotcha/ui/SettingsScreen.kt b/app/src/main/java/com/gotcha/ui/SettingsScreen.kt
index 7ba749f..8d6805d 100644
--- a/app/src/main/java/com/gotcha/ui/SettingsScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/SettingsScreen.kt
@@ -30,9 +30,12 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.pointer.PointerEventPass
import androidx.compose.ui.input.pointer.pointerInput
+import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
+import com.gotcha.R
import com.gotcha.audio.AudioModel
import com.gotcha.data.FeedbackChannel
import com.gotcha.data.Settings
@@ -310,7 +313,7 @@ private fun SettingsHome(
}
SettingsScaffold(
- title = "Settings",
+ title = stringResource(R.string.settings_title),
onBack = onBack,
overlay = overlay,
header = { SettingsSearchField(query = query, onQueryChange = { query = it }) }
@@ -337,14 +340,14 @@ private fun SettingsSearchField(query: String, onQueryChange: (String) -> Unit)
.fillMaxWidth()
.testTag("settings_search"),
singleLine = true,
- placeholder = { Text("Search settings") },
+ placeholder = { Text(stringResource(R.string.settings_search_hint)) },
leadingIcon = { Icon(Icons.Filled.Search, contentDescription = null) },
trailingIcon = {
if (query.isNotEmpty()) {
IconButton(
onClick = { onQueryChange("") },
modifier = Modifier.testTag("settings_search_clear")
- ) { Icon(Icons.Filled.Close, contentDescription = "Clear search") }
+ ) { Icon(Icons.Filled.Close, contentDescription = stringResource(R.string.settings_search_clear)) }
}
}
)
@@ -390,10 +393,11 @@ private fun ColumnScope.SettingsHomeRows(
*/
@Composable
private fun SettingsSearchResults(query: String, onOpenResult: (SettingsSearchResult) -> Unit) {
- val results = filterSettings(query)
+ val text = LocalContext.current.stringLookup()
+ val results = filterSettings(query, text)
if (results.isEmpty()) {
Text(
- text = "No settings match “$query”",
+ text = stringResource(R.string.settings_search_empty, query),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier
@@ -409,7 +413,7 @@ private fun SettingsSearchResults(query: String, onOpenResult: (SettingsSearchRe
page = result.page,
onClick = { onOpenResult(result) },
modifier = Modifier.testTag(result.page.testTag),
- title = result.label
+ title = result.label(text)
)
}
}
@@ -436,12 +440,12 @@ private fun FeatureTourRow(onClick: () -> Unit) {
) {
Column(modifier = Modifier.weight(1f)) {
Text(
- text = "Feature Tour",
+ text = stringResource(R.string.settings_feature_tour),
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.Medium
)
Text(
- text = "Walk through setup again, one step at a time",
+ text = stringResource(R.string.settings_feature_tour_summary),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
@@ -463,12 +467,12 @@ private fun FeedbackRow(onClick: () -> Unit) {
) {
Column(modifier = Modifier.weight(1f)) {
Text(
- text = "Send Feedback",
+ text = stringResource(R.string.settings_feedback),
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.Medium
)
Text(
- text = "Tell us what to improve — nothing is sent until you submit",
+ text = stringResource(R.string.settings_feedback_summary),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
diff --git a/app/src/main/java/com/gotcha/ui/SettingsSearchEntry.kt b/app/src/main/java/com/gotcha/ui/SettingsSearchEntry.kt
index d78dcbb..20bad6a 100644
--- a/app/src/main/java/com/gotcha/ui/SettingsSearchEntry.kt
+++ b/app/src/main/java/com/gotcha/ui/SettingsSearchEntry.kt
@@ -1,5 +1,8 @@
package com.gotcha.ui
+import androidx.annotation.StringRes
+import com.gotcha.R
+
/**
* The search index behind the field at the top of the settings home list.
*
@@ -10,7 +13,10 @@ package com.gotcha.ui
* no row of their own on the home list — and, where the alias names one field,
* says which, so the page can open on it rather than at the top.
*
- * Kept free of Compose so the matching is a plain unit test.
+ * Kept free of Compose so the matching is a plain unit test. Titles, summaries
+ * and field labels are string resources, read through a [StringLookup], so a
+ * query matches them in the app's display language; the aliases stay English,
+ * which still finds a page for someone who types the English name.
*/
/**
@@ -23,13 +29,12 @@ package com.gotcha.ui
*/
data class SettingsField(
val testTag: String,
- val label: String,
+ @StringRes val label: Int,
val keywords: List<String> = emptyList(),
val section: String? = null
) {
- private val haystack: String = (listOf(label) + keywords).joinToString(" ").lowercase()
-
- internal fun matches(token: String): Boolean = haystack.contains(token)
+ internal fun matches(token: String, text: StringLookup): Boolean =
+ (listOf(text(label)) + keywords).joinToString(" ").lowercase().contains(token)
}
/**
@@ -46,18 +51,22 @@ data class SettingsSearchEntry(
* "AI › Speech (TTS / STT)" — because the home list never shows that row, so
* the result is the only place the path can be learned.
*/
- val breadcrumb: String
- get() = page.parentPage()?.let { "${it.title} › ${page.title}" } ?: page.title
+ fun breadcrumb(text: StringLookup): String =
+ page.parentPage()?.let { "${text(it.title)} › ${text(page.title)}" } ?: text(page.title)
- /** Everything this entry matches against, lowercased once at construction. */
- private val haystack: String =
- (listOf(page.title, page.summary) + keywords + fields.flatMap { listOf(it.label) + it.keywords })
+ /** Everything this entry matches against, lowercased. */
+ private fun haystack(text: StringLookup): String =
+ (
+ listOf(text(page.title), text(page.summary)) + keywords +
+ fields.flatMap { listOf(text(it.label)) + it.keywords }
+ )
.joinToString(" ")
.lowercase()
- private val titleWords: Set<String> = wordsOf(page.title)
-
- internal fun matches(token: String): Boolean = haystack.contains(token)
+ internal fun matches(tokens: List<String>, text: StringLookup): Boolean {
+ val haystack = haystack(text)
+ return tokens.all { haystack.contains(it) }
+ }
/**
* The field [tokens] name, or null when they name the page itself.
@@ -70,9 +79,9 @@ data class SettingsSearchEntry(
* order; words spread across the page's aliases and a field find the page
* but no one field.
*/
- internal fun fieldFor(tokens: List<String>): SettingsField? {
- if (wordsOf(tokens.joinToString(" ")).containsAll(titleWords)) return null
- return fields.firstOrNull { field -> tokens.all { field.matches(it) } }
+ internal fun fieldFor(tokens: List<String>, text: StringLookup): SettingsField? {
+ if (wordsOf(tokens.joinToString(" ")).containsAll(wordsOf(text(page.title)))) return null
+ return fields.firstOrNull { field -> tokens.all { field.matches(it, text) } }
}
}
@@ -88,8 +97,8 @@ data class SettingsSearchResult(
val page: SettingsPage get() = entry.page
/** The breadcrumb, carried one step further down when a field matched. */
- val label: String
- get() = this.field?.let { "${entry.breadcrumb} › ${it.label}" } ?: entry.breadcrumb
+ fun label(text: StringLookup): String =
+ this.field?.let { "${entry.breadcrumb(text)} › ${text(it.label)}" } ?: entry.breadcrumb(text)
}
/**
@@ -100,7 +109,7 @@ private fun words(csv: String): List<String> =
csv.split(',').map { it.trim() }.filter { it.isNotEmpty() }
/** Short form for the index below: tag, label, then the aliases as prose. */
-private fun field(testTag: String, label: String, csv: String = "", section: String? = null) =
+private fun field(testTag: String, @StringRes label: Int, csv: String = "", section: String? = null) =
SettingsField(testTag, label, words(csv), section)
/**
@@ -119,23 +128,23 @@ private fun entryFor(page: SettingsPage): SettingsSearchEntry = when (page) {
page,
words("about me, profile"),
listOf(
- field("settings_user_name", "Name"),
- field("settings_user_response_style", "Reply style", "tone"),
- field("settings_user_currency", "Preferred currency")
+ field("settings_user_name", R.string.settings_field_user_name),
+ field("settings_user_response_style", R.string.settings_field_user_response_style, "tone"),
+ field("settings_user_currency", R.string.settings_field_user_currency)
)
)
SettingsPage.LANGUAGE -> SettingsSearchEntry(
page,
words("translate, locale"),
listOf(
- field("settings_open_app_locale", "App language"),
- field("settings_voice_language", "Voice language"),
+ field("settings_open_app_locale", R.string.settings_field_open_app_locale),
+ field("settings_voice_language", R.string.settings_field_voice_language),
field(
"settings_stt_language",
- "Transcription language",
+ R.string.settings_field_stt_language,
"stt language, speech to text language, transcription override"
),
- field("settings_reply_language", "AI reply language")
+ field("settings_reply_language", R.string.settings_field_reply_language)
)
)
SettingsPage.AI -> SettingsSearchEntry(
@@ -146,30 +155,35 @@ private fun entryFor(page: SettingsPage): SettingsSearchEntry = when (page) {
page,
words("samosa sign in, sign in, login, credits, temperature"),
listOf(
- field("settings_llm_provider", "LLM provider", "provider, openai, samosa"),
- field("settings_api_key", "API key"),
- field("settings_base_url", "Base URL", "endpoint"),
- field("settings_model", "Main model", "model"),
+ field("settings_llm_provider", R.string.settings_field_llm_provider, "provider, openai, samosa"),
+ field("settings_api_key", R.string.settings_field_api_key),
+ field("settings_base_url", R.string.settings_field_base_url, "endpoint"),
+ field("settings_model", R.string.settings_field_model, "model"),
field(
"settings_max_tool_rounds",
- "Max tool rounds",
+ R.string.settings_field_max_tool_rounds,
"agent limits",
section = AI_ADVANCED_SECTION
),
- field("settings_api_timeout", "API timeout", "timeout", section = AI_ADVANCED_SECTION)
+ field(
+ "settings_api_timeout",
+ R.string.settings_field_api_timeout,
+ "timeout",
+ section = AI_ADVANCED_SECTION
+ )
)
)
SettingsPage.SPEECH -> SettingsSearchEntry(
page,
words("voice, speak, microphone, kokoro, whisper"),
listOf(
- field("settings_tts_provider", "TTS provider", "tts, text to speech"),
+ field("settings_tts_provider", R.string.settings_field_tts_provider, "tts, text to speech"),
field(
"settings_stt_provider",
- "STT provider",
+ R.string.settings_field_stt_provider,
"stt, transcription, transcribe, speech to text"
),
- field("settings_auto_read_replies", "Auto-read replies aloud", "read aloud, read replies")
+ field("settings_auto_read_replies", R.string.settings_field_auto_read_replies, "read aloud, read replies")
)
)
SettingsPage.PERMISSIONS -> SettingsSearchEntry(
@@ -194,24 +208,24 @@ private fun entryFor(page: SettingsPage): SettingsSearchEntry = when (page) {
page,
words("privacy"),
listOf(
- field("settings_proactive_enabled", "Proactive offers", "offers, suggestions"),
- field("settings_proactive_scan_screen", "Scan screen content", "screen scanning"),
- field("settings_proactive_scan_clipboard", "Scan clipboard", "clipboard"),
- field("settings_proactive_otp", "Detect OTP / codes", "otp")
+ field("settings_proactive_enabled", R.string.settings_field_proactive_enabled, "offers, suggestions"),
+ field("settings_proactive_scan_screen", R.string.settings_field_proactive_scan_screen, "screen scanning"),
+ field("settings_proactive_scan_clipboard", R.string.settings_field_proactive_scan_clipboard, "clipboard"),
+ field("settings_proactive_otp", R.string.settings_field_proactive_otp, "otp")
)
)
SettingsPage.ASSISTIVE_BALL -> SettingsSearchEntry(
page,
words("overlay, hands free, hands-free"),
listOf(
- field("settings_assistive_ball", "Show assistive ball", "floating ball, bubble"),
+ field("settings_assistive_ball", R.string.settings_field_assistive_ball, "floating ball, bubble"),
field(
"settings_pause_night_light",
- "Night Light off for screenshots",
+ R.string.settings_field_pause_night_light,
"night mode, blue light, yellow tint, eye comfort, screenshot colours, screenshot colors"
),
- field("settings_wake_word", "Wake word: Hey Gotcha", "always listening"),
- field("settings_wake_word_sensitivity", "Wake word sensitivity", "sensitivity")
+ field("settings_wake_word", R.string.settings_field_wake_word, "always listening"),
+ field("settings_wake_word_sensitivity", R.string.settings_field_wake_word_sensitivity, "sensitivity")
)
)
SettingsPage.APPEARANCE -> SettingsSearchEntry(
@@ -227,10 +241,14 @@ private fun entryFor(page: SettingsPage): SettingsSearchEntry = when (page) {
"""
),
listOf(
- field("settings_notify_vibration", "Vibration", "vibrate"),
- field("settings_notify_chime", "Chime", "sound"),
- field("settings_task_finished_enabled", "Notify when a task finishes"),
- field("settings_server_messages_enabled", "Server messages", "announcements, sync")
+ field("settings_notify_vibration", R.string.settings_field_notify_vibration, "vibrate"),
+ field("settings_notify_chime", R.string.settings_field_notify_chime, "sound"),
+ field("settings_task_finished_enabled", R.string.settings_field_task_finished_enabled),
+ field(
+ "settings_server_messages_enabled",
+ R.string.settings_field_server_messages_enabled,
+ "announcements, sync"
+ )
)
)
SettingsPage.ABOUT -> SettingsSearchEntry(
@@ -265,10 +283,10 @@ fun settingsFieldFor(page: SettingsPage, testTag: String): SettingsField? =
* extra word narrows rather than widens the result. A blank query matches
* nothing: the caller shows the normal, unfiltered list instead.
*/
-fun filterSettings(query: String): List<SettingsSearchResult> {
+fun filterSettings(query: String, text: StringLookup): List<SettingsSearchResult> {
val tokens = query.lowercase().split(' ', '\t', '\n').filter { it.isNotBlank() }
if (tokens.isEmpty()) return emptyList()
return settingsSearchIndex
- .filter { entry -> tokens.all { entry.matches(it) } }
- .map { entry -> SettingsSearchResult(entry, entry.fieldFor(tokens)) }
+ .filter { entry -> entry.matches(tokens, text) }
+ .map { entry -> SettingsSearchResult(entry, entry.fieldFor(tokens, text)) }
}
diff --git a/app/src/main/java/com/gotcha/ui/SkillsScreen.kt b/app/src/main/java/com/gotcha/ui/SkillsScreen.kt
index eebd0d7..de98e26 100644
--- a/app/src/main/java/com/gotcha/ui/SkillsScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/SkillsScreen.kt
@@ -31,6 +31,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.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
@@ -91,7 +92,7 @@ fun SkillsScreen(
.toSet() + pinnedHost
)
- SettingsScaffold(title = SettingsPage.SKILLS.title, onBack = onBack, overlay = overlay) {
+ SettingsScaffold(title = stringResource(SettingsPage.SKILLS.title), onBack = onBack, overlay = overlay) {
val allSkills = SkillRegistry.getAllSkills()
if (allSkills.isEmpty()) {
Text("No skills loaded.", style = MaterialTheme.typography.bodyMedium)
@@ -170,7 +171,7 @@ fun SkillsScreen(
communitySkillRefreshTick++
overlay.show("Imported '${skill.id}'.")
}.onFailure { e ->
- overlay.show(formatImportError(e))
+ overlay.show(formatImportError(e, localContext.stringLookup()))
}
}
},
@@ -233,7 +234,7 @@ fun SkillsScreen(
"Imported '${skill.id}'."
)
}.onFailure { e ->
- overlay.show(formatImportError(e))
+ overlay.show(formatImportError(e, localContext.stringLookup()))
}
}
}) { Text("Import") }
diff --git a/app/src/main/java/com/gotcha/ui/SpeechScreen.kt b/app/src/main/java/com/gotcha/ui/SpeechScreen.kt
index 0cd1f20..e29204f 100644
--- a/app/src/main/java/com/gotcha/ui/SpeechScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/SpeechScreen.kt
@@ -23,6 +23,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.text.style.TextDecoration
@@ -180,7 +181,7 @@ fun SpeechScreen(
}
}
- SettingsScaffold(title = SettingsPage.SPEECH.title, onBack = onBack, overlay = overlay) {
+ SettingsScaffold(title = stringResource(SettingsPage.SPEECH.title), onBack = onBack, overlay = overlay) {
// ---- Voice / speech recommendations ----
Text(
"For mixed-language text (like Hinglish), Android built-in is the recommended choice. " +
diff --git a/app/src/main/java/com/gotcha/ui/StringLookup.kt b/app/src/main/java/com/gotcha/ui/StringLookup.kt
new file mode 100644
index 0000000..6c62897
--- /dev/null
+++ b/app/src/main/java/com/gotcha/ui/StringLookup.kt
@@ -0,0 +1,20 @@
+package com.gotcha.ui
+
+import android.content.Context
+import androidx.annotation.StringRes
+
+/**
+ * Reads a string resource, formatted with [get]'s args. For code outside
+ * Compose that still has to produce display text — the settings search index,
+ * error messages built in a callback — so it can be handed a [Context]'s
+ * strings in the app and the same in a unit test.
+ */
+fun interface StringLookup {
+ fun get(@StringRes id: Int, vararg args: Any): String
+
+ operator fun invoke(@StringRes id: Int, vararg args: Any): String = get(id, *args)
+}
+
+/** This context's strings, in its current display language. */
+@Suppress("SpreadOperator") // forwarding the format args is the whole point
+fun Context.stringLookup(): StringLookup = StringLookup { id, args -> getString(id, *args) }
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index f758031..7d01201 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -58,4 +58,112 @@
<!-- Shared actions -->
<string name="action_cancel">Cancel</string>
+
+ <!-- Settings pages: title and the summary under it on the home list -->
+ <string name="settings_page_personal_info">Personal Info</string>
+ <string name="settings_page_personal_info_summary">Who you are, currency, reply style</string>
+ <string name="settings_page_language">Language</string>
+ <string name="settings_page_language_summary">App display, voice, transcription and AI reply language</string>
+ <string name="settings_page_ai">AI</string>
+ <string name="settings_page_ai_summary">Model, provider, voice and transcription</string>
+ <string name="settings_page_ai_config">AI Configuration</string>
+ <string name="settings_page_ai_config_summary">Provider, models, agent limits</string>
+ <string name="settings_page_speech">Speech (TTS / STT)</string>
+ <string name="settings_page_speech_summary">Voices, transcription, read replies aloud</string>
+ <string name="settings_page_permissions">Permissions</string>
+ <string name="settings_page_permissions_summary">What the assistant is allowed to do</string>
+ <string name="settings_page_termux">Termux (Linux shell)</string>
+ <string name="settings_page_termux_summary">Run commands in a real Linux shell</string>
+ <string name="settings_page_skills">Skills / Plugins</string>
+ <string name="settings_page_skills_summary">Built-in and community skills</string>
+ <string name="settings_page_proactive">Proactive Assistance</string>
+ <string name="settings_page_proactive_summary">Offers, OTP detection, what may be scanned</string>
+ <string name="settings_page_assistive_ball">Assistive Ball and Wake Word</string>
+ <string name="settings_page_assistive_ball_summary">Floating ball over other apps, hands-free calls, \"Hey Gotcha\"</string>
+ <string name="settings_page_appearance">Appearance</string>
+ <string name="settings_page_appearance_summary">How the app looks</string>
+ <string name="settings_page_notifications">Notifications</string>
+ <string name="settings_page_notifications_summary">Replies, finished tasks, reminders and tips</string>
+ <string name="settings_page_about">About</string>
+ <string name="settings_page_about_summary">Samosa AI, other products, legal, contact</string>
+ <string name="settings_page_about_samosa">About Samosa AI</string>
+ <string name="settings_page_about_samosa_summary">Mission, products, pricing, developers</string>
+ <string name="settings_page_legal">Legal</string>
+ <string name="settings_page_legal_summary">Terms, disclaimer, data retention</string>
+
+ <!-- Settings: shared frame and cards -->
+ <string name="action_back">← Back</string>
+ <string name="settings_advanced">Advanced settings</string>
+ <string name="settings_import_failed">Import failed: %1$s</string>
+ <string name="samosa_tier_free">Free</string>
+ <string name="samosa_signed_in">Signed in to Samosa AI</string>
+ <string name="samosa_not_signed_in">Not signed in</string>
+ <string name="samosa_credits_remaining">Credits remaining: %1$s</string>
+ <string name="samosa_sign_in_hint">Sign in with Google to use Samosa AI. Your OpenAI-compatible settings are kept separately and are unaffected.</string>
+ <string name="samosa_please_wait">Please wait…</string>
+ <string name="samosa_log_out">Log out</string>
+ <string name="samosa_signing_in">Signing in…</string>
+ <string name="samosa_sign_in">Sign in with Google</string>
+ <string name="referral_title">🎁 Invite Friends, Earn Free Credits</string>
+ <string name="referral_description">Share your invite code — you both get bonus credits when a friend signs up with it.</string>
+ <string name="referral_your_code">Your invite code:</string>
+ <string name="referral_copy_code">Copy Code</string>
+ <string name="referral_share_link">Share Invite Link</string>
+ <string name="referral_referred_by">🎁 Referred by</string>
+ <string name="referral_enter_code">Enter Invite Code</string>
+ <string name="referral_code_placeholder">AIR-XXXXXX</string>
+ <string name="referral_apply">Apply</string>
+ <string name="influencer_title">🌟 Got an audience? Let\'s team up</string>
+ <string name="influencer_description">If you\'re an influencer with a solid following, we\'d love to get Samosa AI in your hands early — with perks to match.</string>
+ <string name="influencer_apply">Apply as an Influencer</string>
+ <plurals name="referral_claim_hours_left">
+ <item quantity="one">You have %1$dh left to claim an invite code.</item>
+ <item quantity="other">You have %1$dh left to claim an invite code.</item>
+ </plurals>
+ <plurals name="referral_stats">
+ <item quantity="one">You\'ve referred %1$d friend • %2$s credits earned</item>
+ <item quantity="other">You\'ve referred %1$d friends • %2$s credits earned</item>
+ </plurals>
+
+ <!-- Settings search: the controls a result can point at -->
+ <string name="settings_field_user_name">Name</string>
+ <string name="settings_field_user_response_style">Reply style</string>
+ <string name="settings_field_user_currency">Preferred currency</string>
+ <string name="settings_field_open_app_locale">App language</string>
+ <string name="settings_field_voice_language">Voice language</string>
+ <string name="settings_field_reply_language">AI reply language</string>
+ <string name="settings_field_llm_provider">LLM provider</string>
+ <string name="settings_field_api_key">API key</string>
+ <string name="settings_field_base_url">Base URL</string>
+ <string name="settings_field_model">Main model</string>
+ <string name="settings_field_api_timeout">API timeout</string>
+ <string name="settings_field_tts_provider">TTS provider</string>
+ <string name="settings_field_auto_read_replies">Auto-read replies aloud</string>
+ <string name="settings_field_proactive_enabled">Proactive offers</string>
+ <string name="settings_field_proactive_scan_screen">Scan screen content</string>
+ <string name="settings_field_proactive_scan_clipboard">Scan clipboard</string>
+ <string name="settings_field_proactive_otp">Detect OTP / codes</string>
+ <string name="settings_field_assistive_ball">Show assistive ball</string>
+ <string name="settings_field_wake_word">Wake word: Hey Gotcha</string>
+ <string name="settings_field_wake_word_sensitivity">Wake word sensitivity</string>
+ <string name="settings_field_notify_vibration">Vibration</string>
+ <string name="settings_field_notify_chime">Chime</string>
+ <string name="settings_field_task_finished_enabled">Notify when a task finishes</string>
+ <string name="settings_field_server_messages_enabled">Server messages</string>
+
+ <!-- Settings search: controls with longer aliases -->
+ <string name="settings_field_stt_language">Transcription language</string>
+ <string name="settings_field_max_tool_rounds">Max tool rounds</string>
+ <string name="settings_field_stt_provider">STT provider</string>
+ <string name="settings_field_pause_night_light">Night Light off for screenshots</string>
+
+ <!-- Settings home -->
+ <string name="settings_title">Settings</string>
+ <string name="settings_search_hint">Search settings</string>
+ <string name="settings_search_clear">Clear search</string>
+ <string name="settings_search_empty">No settings match “%1$s”</string>
+ <string name="settings_feature_tour">Feature Tour</string>
+ <string name="settings_feature_tour_summary">Walk through setup again, one step at a time</string>
+ <string name="settings_feedback">Send Feedback</string>
+ <string name="settings_feedback_summary">Tell us what to improve — nothing is sent until you submit</string>
</resources>
diff --git a/app/src/test/java/com/gotcha/tools/AppInfoToolTest.kt b/app/src/test/java/com/gotcha/tools/AppInfoToolTest.kt
index 7592033..c3bf6f5 100644
--- a/app/src/test/java/com/gotcha/tools/AppInfoToolTest.kt
+++ b/app/src/test/java/com/gotcha/tools/AppInfoToolTest.kt
@@ -40,11 +40,15 @@ class AppInfoToolTest {
fun `every settings page the app can open is documented`() {
val text = tool.aboutGotcha().message
+ // The handbook is English, like everything the model reads, so it names the
+ // pages by their English titles.
+ val context = ApplicationProvider.getApplicationContext<Context>()
SettingsPage.entries.forEach { page ->
+ val title = context.getString(page.title)
assertTrue(
- "the handbook does not mention the '${page.title}' settings page, so the agent " +
+ "the handbook does not mention the '$title' settings page, so the agent " +
"cannot tell the user how to reach it",
- text.contains(page.title)
+ text.contains(title)
)
}
}
diff --git a/app/src/test/java/com/gotcha/ui/SettingsCommonTest.kt b/app/src/test/java/com/gotcha/ui/SettingsCommonTest.kt
index 4c21e03..5f813d2 100644
--- a/app/src/test/java/com/gotcha/ui/SettingsCommonTest.kt
+++ b/app/src/test/java/com/gotcha/ui/SettingsCommonTest.kt
@@ -15,38 +15,32 @@ import java.time.Instant
class SettingsCommonTest {
@Test
- fun `formatRemainingClaimHours calculates correct remaining time`() {
+ fun `remainingClaimHours calculates correct remaining time`() {
val now = Instant.parse("2026-08-20T12:00:00Z")
// 10 hours ago -> 62 hours left
val created10hAgo = "2026-08-20T02:00:00Z"
- assertEquals(
- "You have 62h left to claim an invite code.",
- formatRemainingClaimHours(created10hAgo, now = now)
- )
+ assertEquals(62L, remainingClaimHours(created10hAgo, now = now))
// 71 hours ago -> 1 hour left
val created71hAgo = "2026-08-17T13:00:00Z"
- assertEquals(
- "You have 1h left to claim an invite code.",
- formatRemainingClaimHours(created71hAgo, now = now)
- )
+ assertEquals(1L, remainingClaimHours(created71hAgo, now = now))
// Exactly 72 hours ago -> 0 hours left -> returns null
val created72hAgo = "2026-08-17T12:00:00Z"
- assertNull(formatRemainingClaimHours(created72hAgo, now = now))
+ assertNull(remainingClaimHours(created72hAgo, now = now))
// 80 hours ago -> past window -> returns null
val created80hAgo = "2026-08-17T04:00:00Z"
- assertNull(formatRemainingClaimHours(created80hAgo, now = now))
+ assertNull(remainingClaimHours(created80hAgo, now = now))
}
@Test
- fun `formatRemainingClaimHours handles invalid input safely`() {
+ fun `remainingClaimHours handles invalid input safely`() {
val now = Instant.parse("2026-08-20T12:00:00Z")
- assertNull(formatRemainingClaimHours(null, now = now))
- assertNull(formatRemainingClaimHours("", now = now))
- assertNull(formatRemainingClaimHours("invalid-date", now = now))
+ assertNull(remainingClaimHours(null, now = now))
+ assertNull(remainingClaimHours("", now = now))
+ assertNull(remainingClaimHours("invalid-date", now = now))
}
@Test
diff --git a/app/src/test/java/com/gotcha/ui/SettingsSearchEntryTest.kt b/app/src/test/java/com/gotcha/ui/SettingsSearchEntryTest.kt
index ba44aba..8caa662 100644
--- a/app/src/test/java/com/gotcha/ui/SettingsSearchEntryTest.kt
+++ b/app/src/test/java/com/gotcha/ui/SettingsSearchEntryTest.kt
@@ -1,19 +1,31 @@
package com.gotcha.ui
+import android.content.Context
+import androidx.test.core.app.ApplicationProvider
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
+import org.junit.runner.RunWith
+import org.robolectric.RobolectricTestRunner
/**
* The matching behind the settings search field. The cases named in issue #86
* are the point of the feature: each one is a control with no row of its own on
* the home list, found by the word someone would actually type for it.
+ * Titles and labels are string resources, so this runs on Robolectric's (English) ones.
*/
+@RunWith(RobolectricTestRunner::class)
class SettingsSearchEntryTest {
+ private val text = ApplicationProvider.getApplicationContext<Context>().stringLookup()
+
+ private fun filterSettings(query: String) = filterSettings(query, text)
+
private fun pagesFor(query: String) = filterSettings(query).map { it.page }
+ private val SettingsPage.titleText: String get() = text(title)
+
@Test
fun keywordsFindThePageOwningTheControl() {
assertTrue(SettingsPage.SPEECH in pagesFor("voice"))
@@ -72,8 +84,8 @@ class SettingsSearchEntryTest {
fun everyPageIsSearchableByItsOwnTitle() {
SettingsPage.entries.forEach { page ->
assertTrue(
- "${page.title} cannot be found by its own title",
- page in pagesFor(page.title)
+ "${page.titleText} cannot be found by its own title",
+ page in pagesFor(page.titleText)
)
}
}
@@ -86,10 +98,10 @@ class SettingsSearchEntryTest {
@Test
fun nestedPagesNameTheirHub() {
val speech = settingsSearchIndex.first { it.page == SettingsPage.SPEECH }
- assertEquals("AI › ${SettingsPage.SPEECH.title}", speech.breadcrumb)
+ assertEquals("AI › ${SettingsPage.SPEECH.titleText}", speech.breadcrumb(text))
val termux = settingsSearchIndex.first { it.page == SettingsPage.TERMUX }
- assertEquals(SettingsPage.TERMUX.title, termux.breadcrumb)
+ assertEquals(SettingsPage.TERMUX.titleText, termux.breadcrumb(text))
}
private fun fieldFor(query: String, page: SettingsPage) =
@@ -110,7 +122,7 @@ class SettingsSearchEntryTest {
@Test
fun aPagesOwnTitleHighlightsNothing() {
SettingsPage.entries.forEach { page ->
- assertNull("${page.title} highlights a field", fieldFor(page.title, page))
+ assertNull("${page.titleText} highlights a field", fieldFor(page.titleText, page))
}
}
@@ -123,7 +135,7 @@ class SettingsSearchEntryTest {
@Test
fun aFieldResultNamesTheFieldInItsLabel() {
val result = filterSettings("max tool rounds").first { it.page == SettingsPage.AI_CONFIG }
- assertEquals("AI › AI Configuration › Max tool rounds", result.label)
+ assertEquals("AI › AI Configuration › Max tool rounds", result.label(text))
}
@Test
@@ -136,7 +148,7 @@ class SettingsSearchEntryTest {
fun fieldsAreFoundByTheirPageAndTag() {
assertEquals(
"Max tool rounds",
- settingsFieldFor(SettingsPage.AI_CONFIG, "settings_max_tool_rounds")?.label
+ settingsFieldFor(SettingsPage.AI_CONFIG, "settings_max_tool_rounds")?.label?.let { text(it) }
)
assertNull(settingsFieldFor(SettingsPage.SPEECH, "settings_max_tool_rounds"))
}