Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,27 @@ Noto Sans Mono (IPA subset)
has no system font to fall back on). Subset to U+0250-036F and
U+1D00-1DBF.

Noto Sans (Cyrillic subset)
Source: https://github.com/notofonts/latin-greek-cyrillic
Copyright: 2022 The Noto Project Authors
License: SIL Open Font License 1.1 (see licenses/fonts/OFL-NotoSans.txt)
Used as: Russian interface text, in the web app only. Subset to
U+0400-04FF and U+2116.

Noto Sans Devanagari (subset)
Source: https://github.com/notofonts/devanagari
Copyright: 2022 The Noto Project Authors
License: SIL Open Font License 1.1 (see licenses/fonts/OFL-NotoSansDevanagari.txt)
Used as: Hindi interface text, in the web app only. Subset to
U+0900-097F, U+200C-200D, U+20B9 and U+25CC.

Noto Sans Arabic (subset)
Source: https://github.com/notofonts/arabic
Copyright: 2022 The Noto Project Authors
License: SIL Open Font License 1.1 (see licenses/fonts/OFL-NotoSansArabic.txt)
Used as: Arabic interface text, in the web app only. Subset to
U+0600-06FF, U+200C-200F and U+25CC.

stb_vorbis 1.22
Source: https://github.com/nothings/stb (vendored in shared/src/nativeInterop/stb_vorbis)
Copyright: 2017 Sean Barrett
Expand Down
2 changes: 1 addition & 1 deletion androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ android {

// Ship only the locales the app is translated into, so the APK does not
// carry every AndroidX/Play Services translation.
androidResources.localeFilters += listOf("en", "es", "fr", "de")
androidResources.localeFilters += listOf("en", "es", "fr", "de", "ru", "hi", "ar")

// Extra points for rhythm and intonation (engine ProsodyBonus), computed
// on-device against the item's reference audio. Off by default, like
Expand Down
8 changes: 8 additions & 0 deletions androidApp/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">

<!-- Downloads (background service and its notification) -->
<string name="download_channel_name">التنزيلات</string>
<string name="download_channel_description">تستمر التنزيلات بعد مغادرة التطبيق.</string>

</resources>
8 changes: 8 additions & 0 deletions androidApp/src/main/res/values-hi/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">

<!-- Downloads (background service and its notification) -->
<string name="download_channel_name">डाउनलोड</string>
<string name="download_channel_description">ऐप से बाहर जाने पर भी डाउनलोड चलता रहता है।</string>

</resources>
8 changes: 8 additions & 0 deletions androidApp/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">

<!-- Downloads (background service and its notification) -->
<string name="download_channel_name">Загрузки</string>
<string name="download_channel_description">Скачивание продолжается, когда вы выходите из приложения.</string>

</resources>
3 changes: 3 additions & 0 deletions androidApp/src/main/res/xml/locales_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
<locale android:name="es" />
<locale android:name="fr" />
<locale android:name="de" />
<locale android:name="ru" />
<locale android:name="hi" />
<locale android:name="ar" />
</locale-config>
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ class LocaleFormatParityTest {
}
}

@Test
fun `Arabic numbers use Western digits`() {
for (tag in listOf("ar", "ar-EG", "ar-SA")) {
val text = formatDecimal(12.5, 1, tag)
assertEquals(tag, "125", text.filter { it.isDigit() })
}
}

@Test
fun `formatBytes fixed strings`() {
assertEquals("341.8 MB", formatBytes(358_357_774L, "en"))
Expand Down
3 changes: 3 additions & 0 deletions docs/WEB.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ cd shared/build/dist/wasmJs/productionExecutable && python3 -m http.server 8096
- **IPA symbols** that JetBrains Mono lacks come from a Noto Sans Mono subset
(`wasmJsMain/composeResources/font`). It is preloaded as the fallback font, because a browser gives
Skia no system fonts.
- **Russian, Hindi and Arabic** need a fallback for the same reason: Noto subsets in the same folder,
57 to 130 KB gzipped, each fetched only when it is the interface language. Compose takes no layout
direction from the page, so `Main.kt` sets right to left for Arabic.
- **Back**: the browser's Back button (and Safari's edge swipe) runs the innermost `PlatformBackHandler`.

## Installing it (PWA)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.glosso.engine.lesson

import com.glosso.engine.model.DialogueModel
import kotlinx.serialization.Serializable

/**
Expand Down Expand Up @@ -42,6 +43,31 @@ data class RecallCard(
val displayPhonetic: String get() = displayIpa.ifBlank { ipa }
}

/**
* This card with the current content of its line, from [dialogue] already worded
* for [accent]; its place on the ladder is kept. A line that no longer exists
* leaves the card as stored, which still pairs its own text and clip.
*/
fun RecallCard.worded(dialogue: DialogueModel, accent: String): RecallCard {
val index = ref.substringAfter("#t", "").toIntOrNull() ?: return this
val turn = dialogue.turns.getOrNull(index) ?: return this
val partner = dialogue.turns.getOrNull(index - 1)?.takeIf { hasPartner }
return copy(
text = turn.text,
ipa = turn.ipa,
displayIpa = turn.displayIpa,
accentIpa = turn.accentIpa,
audio = turn.audio.ifEmpty { audio },
cues = turn.translations.ifEmpty { cues },
speaker = turn.speaker,
partnerSpeaker = partner?.speaker ?: partnerSpeaker,
partnerText = partner?.text ?: partnerText,
partnerAudio = partner?.audio?.ifEmpty { null } ?: partnerAudio,
partnerTranslations = partner?.translations?.ifEmpty { null } ?: partnerTranslations,
accent = accent,
)
}

/**
* Spaced recall of phrases: a phrase said from memory comes back after a
* growing number of days, and one that was not recalled comes back tomorrow.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.glosso.engine.phonetics

/**
* A sound as a learner of [accent] reads it. Scoring, the profile and the drills
* are keyed by the dictionary's American-style phones, which a British textbook
* writes differently. Where one key covers two British vowels (the /ɑ/ of "cot"
* and "father"), both are shown.
*/
object AccentSymbols {

private val BRITISH = mapOf(
"ɑ" to "ɒ, ɑː",
"ɔ" to "ɔː, ɒ",
"i" to "iː",
"u" to "uː",
"oʊ" to "əʊ",
"ɛ" to "e",
"ɹ" to "r",
"ɝ" to "ɜː",
"ɚ" to "ə",
)

fun shown(phone: String, accent: String): String =
if (accent == "en-GB") BRITISH[phone] ?: phone else phone
}
Loading