/** * The language the user is TALKING TO the assistant in (BOFF-7108). * * Separate from the app locale on purpose. A farmer whose phone and UI are in * English may well speak Tamil, and until now the only way to dictate Tamil was * to translate the entire interface — the recogniser language was derived from * `useI18n().locale`, so the two could not be chosen independently. * * One selection drives three things, which is the point: * 1. `recognition.lang` — what the recogniser is listening for; * 2. the reply-language directive — what the model answers in; * 3. the voice for reading that reply aloud. * * Deliberately NOT keyed on the app `Locale` union. That union is the set of * languages the INTERFACE is translated into (9, from fe-libs); this is the set * of languages a user might SPEAK, which is larger and grows for different * reasons. Tying them together is what created the problem. */ export interface AssistantLanguage { /** Primary subtag. What we persist, and what the speech-locale helpers take. */ code: string; /** BCP-47 tag handed to the Web Speech APIs — region matters to acoustic models. */ tag: string; /** * The ENDONYM — what a speaker calls their own language. Someone who reads * only Tamil cannot find "Tamil" in a list; they can find "தமிழ்". */ label: string; /** * English name, for the model-facing directive. * * Hardcoded rather than derived from `Intl.DisplayNames` because this string * goes into a prompt: it must be stable and correct regardless of the reader's * browser, and a missing `Intl` implementation must not silently degrade an * instruction into a bare subtag the model may answer *about* instead of *in*. */ english: string; /** * Speaking rate for this language, 1 = the engine's default. * * Nothing set a rate at all until now, so every user heard the spec default of * 1.0 — reported as "it reads fast", which it is: a synthesised voice at 1.0 is * harder to follow than a person at the same nominal speed, and harder again * when the listener is outdoors or hearing a second language. * * Indic and Arabic get a further reduction. Their scripts pack more syllables * per character than Latin, so the same nominal rate delivers noticeably more * speech per second. */ rate?: number; } /** Applied when a language does not override it. */ export declare const DEFAULT_SPEECH_RATE = 0.9; /** * India first and by speaker count, then the other app locales. * * Regions follow where HealthyBowl operates: `-IN` for the Indic languages, * because a recogniser tuned for `ur-PK` or a voice for `bn-BD` is the wrong * pronunciation model for this product's users. */ export declare const ASSISTANT_LANGUAGES: readonly AssistantLanguage[]; export declare function findAssistantLanguage(code: string | null | undefined): AssistantLanguage | null; /** * Which language to use: the user's explicit choice, else the app locale, else * English. * * The app-locale step is what keeps this backwards-compatible — a user who never * touches the new control behaves exactly as before, because the value derived * is the one the old code derived. An app locale outside this list (or a stale * persisted code from a build that offered more) degrades to English rather than * handing the recogniser a tag it will reject. */ export declare function resolveAssistantLanguage(selectedCode: string | null | undefined, appLocale: string): AssistantLanguage; //# sourceMappingURL=languages.d.ts.map