From b1eb619e308266cca7ec6855e1cdfd81b6031c60 Mon Sep 17 00:00:00 2001 From: IgnacioLD <178957758+IgnacioLD@users.noreply.github.com> Date: Tue, 24 Nov 2026 02:46:35 +0100 Subject: [PATCH] feat(languages): label experimental languages and offer Spanish The language pickers now show when a language has no tuned scoring model and explain that its score can be low even for native speakers. Spanish joins the offered languages as experimental. --- docs/ADD_LANGUAGE.md | 2 +- .../com/glosso/engine/model/LanguagePack.kt | 2 +- .../glosso/engine/model/LanguagePacksTest.kt | 2 +- .../composeResources/values-ar/strings.xml | 2 ++ .../composeResources/values-de/strings.xml | 2 ++ .../composeResources/values-es/strings.xml | 2 ++ .../composeResources/values-fr/strings.xml | 2 ++ .../composeResources/values-hi/strings.xml | 2 ++ .../composeResources/values-ru/strings.xml | 2 ++ .../composeResources/values/strings.xml | 2 ++ .../kotlin/com/glosso/app/OnboardingScreen.kt | 3 ++- .../kotlin/com/glosso/app/SettingsScreen.kt | 25 +++++++++++++++---- 12 files changed, 39 insertions(+), 9 deletions(-) diff --git a/docs/ADD_LANGUAGE.md b/docs/ADD_LANGUAGE.md index 307b9cf..e4ce367 100644 --- a/docs/ADD_LANGUAGE.md +++ b/docs/ADD_LANGUAGE.md @@ -382,7 +382,7 @@ inventario. `experimental = true` en el pack hasta validarlo. siguen ahi pero no pueden disparar con una referencia de espeak. espeak tambien escribe `anjˈo` para "agneau" (y `ɲ` solo a final de palabra) y deja un guion final en los cliticos (`ʒə-`), que el scorer ignora. -- **No se ofrece en la app:** `LanguagePacks.offered` solo incluye ingles y ruso hasta que +- **No se ofrece en la app:** `LanguagePacks.offered` solo incluye ingles, ruso y espanol hasta que el banco `content/fr` este listo. El pack sigue en `LanguagePacks.all` y `LanguagePreferences` no lo acepta aunque quede guardado de una build anterior. - **Sin validar:** reconocimiento con audio real en frances. Antes de ofrecerlo: diff --git a/engine/src/commonMain/kotlin/com/glosso/engine/model/LanguagePack.kt b/engine/src/commonMain/kotlin/com/glosso/engine/model/LanguagePack.kt index cde0438..4c21eb7 100644 --- a/engine/src/commonMain/kotlin/com/glosso/engine/model/LanguagePack.kt +++ b/engine/src/commonMain/kotlin/com/glosso/engine/model/LanguagePack.kt @@ -326,7 +326,7 @@ object LanguagePacks { * French and German are deliberately absent until theirs do. See * docs/ADD_LANGUAGE.md. */ - val offered: List = listOf(ENGLISH, RUSSIAN) + val offered: List = listOf(ENGLISH, RUSSIAN, SPANISH) /** * Resolves a client language code to a known pack. Accepts region forms diff --git a/engine/src/commonTest/kotlin/com/glosso/engine/model/LanguagePacksTest.kt b/engine/src/commonTest/kotlin/com/glosso/engine/model/LanguagePacksTest.kt index 12cfd0c..ea98341 100644 --- a/engine/src/commonTest/kotlin/com/glosso/engine/model/LanguagePacksTest.kt +++ b/engine/src/commonTest/kotlin/com/glosso/engine/model/LanguagePacksTest.kt @@ -22,7 +22,7 @@ class LanguagePacksTest { @Test fun `the wired packs are english - french - german - russian and spanish`() { assertEquals(listOf("en", "fr", "de", "ru", "es"), LanguagePacks.all.map { it.code }) - assertEquals(listOf("en", "ru"), LanguagePacks.offered.map { it.code }) + assertEquals(listOf("en", "ru", "es"), LanguagePacks.offered.map { it.code }) } @Test diff --git a/shared/src/commonMain/composeResources/values-ar/strings.xml b/shared/src/commonMain/composeResources/values-ar/strings.xml index 4200fb5..d7e57ea 100644 --- a/shared/src/commonMain/composeResources/values-ar/strings.xml +++ b/shared/src/commonMain/composeResources/values-ar/strings.xml @@ -343,6 +343,8 @@ لغة التعلّم اللغة التي تدرسها، ويعتمد عليها المحتوى والتمارين والصوت. اللغة + %1$s - تجريبي + لغة تجريبية: الدرجة تقريبية وقد تكون منخفضة حتى للناطقين الأصليين. اللهجة المرجعية لهجة كل التسجيلات وكل الدروس. اللهجة diff --git a/shared/src/commonMain/composeResources/values-de/strings.xml b/shared/src/commonMain/composeResources/values-de/strings.xml index 4ec2e4c..4c94f50 100644 --- a/shared/src/commonMain/composeResources/values-de/strings.xml +++ b/shared/src/commonMain/composeResources/values-de/strings.xml @@ -338,6 +338,8 @@ Zielsprache Die Sprache, die du lernst. Inhalt, Übungen und Audio richten sich danach. Sprache + %1$s - experimentell + Experimentelle Sprache: Die Bewertung ist nur ein Richtwert und kann selbst bei Muttersprachlern niedrig ausfallen. Referenzakzent Der Akzent aller Aufnahmen und Lektionen. Akzent diff --git a/shared/src/commonMain/composeResources/values-es/strings.xml b/shared/src/commonMain/composeResources/values-es/strings.xml index a09408e..13c5fe7 100644 --- a/shared/src/commonMain/composeResources/values-es/strings.xml +++ b/shared/src/commonMain/composeResources/values-es/strings.xml @@ -320,6 +320,8 @@ Idioma objetivo El idioma que estudias. El contenido, los ejercicios y el audio lo siguen. Idioma + %1$s - experimental + Idioma experimental: la nota es orientativa y puede salir baja incluso a nativos. Acento de referencia El acento de todas las grabaciones y lecciones. Acento diff --git a/shared/src/commonMain/composeResources/values-fr/strings.xml b/shared/src/commonMain/composeResources/values-fr/strings.xml index 098ead1..dd0a050 100644 --- a/shared/src/commonMain/composeResources/values-fr/strings.xml +++ b/shared/src/commonMain/composeResources/values-fr/strings.xml @@ -339,6 +339,8 @@ Langue étudiée La langue que tu étudies. Le contenu, les exercices et l'audio la suivent. Langue + %1$s - expérimental + Langue expérimentale : la note est indicative et peut être basse même pour un locuteur natif. Accent de référence L'accent de tous les enregistrements et de toutes les leçons. Accent diff --git a/shared/src/commonMain/composeResources/values-hi/strings.xml b/shared/src/commonMain/composeResources/values-hi/strings.xml index a65463e..96cbedf 100644 --- a/shared/src/commonMain/composeResources/values-hi/strings.xml +++ b/shared/src/commonMain/composeResources/values-hi/strings.xml @@ -331,6 +331,8 @@ सीखने की भाषा वह भाषा जो आप सीख रहे हैं। कॉन्टेंट, ड्रिल और ऑडियो इसी के हिसाब से होते हैं। भाषा + %1$s - प्रायोगिक + प्रायोगिक भाषा: स्कोर अनुमानित है और मूल वक्ताओं का भी कम आ सकता है। रेफ़रेंस एक्सेंट हर रिकॉर्डिंग और हर लेसन का एक्सेंट। एक्सेंट diff --git a/shared/src/commonMain/composeResources/values-ru/strings.xml b/shared/src/commonMain/composeResources/values-ru/strings.xml index cfe27de..2adacb9 100644 --- a/shared/src/commonMain/composeResources/values-ru/strings.xml +++ b/shared/src/commonMain/composeResources/values-ru/strings.xml @@ -322,6 +322,8 @@ Изучаемый язык Язык, который вы учите. От него зависят материалы, упражнения и аудио. Язык + %1$s - экспериментально + Экспериментальный язык: оценка приблизительная и может быть низкой даже у носителей. Эталонный акцент Акцент всех записей и уроков. Акцент diff --git a/shared/src/commonMain/composeResources/values/strings.xml b/shared/src/commonMain/composeResources/values/strings.xml index 514faf0..725bb91 100644 --- a/shared/src/commonMain/composeResources/values/strings.xml +++ b/shared/src/commonMain/composeResources/values/strings.xml @@ -341,6 +341,8 @@ Target language The language you're studying. Content, drills and audio follow it. Language + %1$s - experimental + Experimental language: the score is approximate and can be low even for native speakers. Reference accent The accent of every recording and every lesson. Accent diff --git a/shared/src/commonMain/kotlin/com/glosso/app/OnboardingScreen.kt b/shared/src/commonMain/kotlin/com/glosso/app/OnboardingScreen.kt index cfaa59e..e4152e3 100644 --- a/shared/src/commonMain/kotlin/com/glosso/app/OnboardingScreen.kt +++ b/shared/src/commonMain/kotlin/com/glosso/app/OnboardingScreen.kt @@ -331,7 +331,7 @@ private fun TargetLanguageChoice(selected: String, onSelect: (String) -> Unit) { verticalAlignment = Alignment.CenterVertically, ) { Text( - text = languageDisplay(pack.code, pack.displayName, pack.nativeName), + text = languageDisplay(pack), style = MaterialTheme.typography.bodyLarge, fontWeight = if (active) FontWeight.Bold else FontWeight.Medium, color = if (active) MaterialTheme.colorScheme.onSurface @@ -348,6 +348,7 @@ private fun TargetLanguageChoice(selected: String, onSelect: (String) -> Unit) { } Hairline() } + ExperimentalLanguageNote(selected) } /** diff --git a/shared/src/commonMain/kotlin/com/glosso/app/SettingsScreen.kt b/shared/src/commonMain/kotlin/com/glosso/app/SettingsScreen.kt index 6eaf075..cae83db 100644 --- a/shared/src/commonMain/kotlin/com/glosso/app/SettingsScreen.kt +++ b/shared/src/commonMain/kotlin/com/glosso/app/SettingsScreen.kt @@ -59,6 +59,7 @@ import com.glosso.app.designsystem.Sizes import com.glosso.app.designsystem.Space import com.glosso.app.download.WifiOnlyPreference import com.glosso.app.resources.* +import com.glosso.engine.model.LanguagePack import com.glosso.engine.model.LanguagePacks import kotlinx.coroutines.launch import org.jetbrains.compose.resources.stringResource @@ -140,7 +141,7 @@ fun SettingsScreen(onBack: () -> Unit, vm: ScoringViewModel = scoringViewModel() SettingChoice( label = stringResource(Res.string.settings_language), options = OfferedLanguages.all.map { - it.code to languageDisplay(it.code, it.displayName, it.nativeName) + it.code to languageDisplay(it) }, selected = language, onSelect = { code -> @@ -153,6 +154,7 @@ fun SettingsScreen(onBack: () -> Unit, vm: ScoringViewModel = scoringViewModel() } }, ) + ExperimentalLanguageNote(language) if (actions.appLocaleSupported) { SectionBreak() @@ -465,16 +467,29 @@ internal fun appLocaleDisplay(tag: String): String = when (tag) { /** Localized display names for the language picker, with the native name in brackets. */ @Composable -internal fun languageDisplay(code: String, displayName: String, nativeName: String): String { - val localized = when (code) { +internal fun languageDisplay(pack: LanguagePack): String { + val localized = when (pack.code) { "en" -> stringResource(Res.string.settings_lang_en) "de" -> stringResource(Res.string.settings_lang_de) "es" -> stringResource(Res.string.settings_lang_es) "ru" -> stringResource(Res.string.settings_lang_ru) "zh" -> stringResource(Res.string.settings_lang_zh) - else -> displayName + else -> pack.displayName } - return if (localized == nativeName) localized else "$localized ($nativeName)" + val name = if (localized == pack.nativeName) localized else "$localized (${pack.nativeName})" + return if (pack.experimental) stringResource(Res.string.language_experimental_label, name) else name +} + +/** Says why the score of a language without a tuned model can be low even for a native speaker. */ +@Composable +internal fun ExperimentalLanguageNote(code: String) { + if (OfferedLanguages.orNull(code)?.experimental != true) return + Spacer(Modifier.height(Space.x8)) + Text( + text = stringResource(Res.string.language_experimental_note), + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) } @Composable