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.

fix(service): add Italian/Portuguese branches to isTextInLanguage (P0-7)

Durganshu Mishra364675ad38ed
diff --git a/app/src/main/java/com/gotcha/service/SmartActionDetector.kt b/app/src/main/java/com/gotcha/service/SmartActionDetector.kt
index 9cf431c..a6173f2 100644
--- a/app/src/main/java/com/gotcha/service/SmartActionDetector.kt
+++ b/app/src/main/java/com/gotcha/service/SmartActionDetector.kt
@@ -764,7 +764,19 @@ object SmartActionDetector {
clean.lowercase().split("\\s+".toRegex())
.count { it.trimEnd('.', ',', '!', '?') in setOf("der", "die", "das", "ein", "eine", "mit") } >= 2
}
- else -> false
+ lang.contains("italian") -> {
+ Regex("[àèéìòù]").containsMatchIn(clean.lowercase()) ||
+ clean.lowercase().split("\\s+".toRegex())
+ .count { it.trimEnd('.', ',', '!', '?') in setOf("il", "lo", "la", "gli", "delle", "con", "per") } >= 2
+ }
+ lang.contains("portuguese") -> {
+ Regex("[ãõáéíóúâêôç]").containsMatchIn(clean.lowercase()) ||
+ clean.lowercase().split("\\s+".toRegex())
+ .count { it.trimEnd('.', ',', '!', '?') in setOf("o", "a", "os", "as", "com", "para", "não") } >= 2
+ }
+ // Unhandled languages: assume already-in-language rather than always
+ // offering a false "Translate" prompt (issue #42 P0-7).
+ else -> true
}
}
}