3.1 KiB
3.1 KiB
| applyTo |
|---|
| lib/pangea/languages/**,lib/pangea/learning_settings/**,lib/pangea/login/pages/language_selection_page.dart |
Language List — Client
For the cross-service language list architecture, L1/L2 definitions, and CMS schema, see language-list.instructions.md.
Data Flow
LanguageRepo._fetch()fetches all languages from CMS REST API (/api/languages?limit=500&sort=language_name) — public, no authPLanguageStorecaches the list inSharedPreferencesand re-fetches roughly daily- Hardcoded fallback in
LanguageConstants.languageListif CMS is unreachable and cache is empty
L1/L2 Filtering
PLanguageStore exposes three getters:
| Getter | Filter | Used for |
|---|---|---|
baseOptions |
All languages (no filter) | L1 / source / native language selection |
targetOptions |
element.l2 (i.e., l2Support != L2SupportEnum.na) |
L2 / target / learning language selection |
unlocalizedTargetOptions |
L2 filter + excludes regional variants (e.g., keeps "Portuguese" but not "Portuguese (Brazil)") | Course creation language filter |
The l2 getter on LanguageModel returns l2Support != L2SupportEnum.na.
Key Usage Sites
- Login language selection:
language_selection_page.dart— usestargetOptionsfor L2 chips, defaults L1 to system language - Learning settings dialog:
p_language_dialog.dart—baseOptionsfor L1,targetOptionsfor L2 - Learning settings view:
settings_learning_view.dart— same pattern - Bot chat settings:
bot_chat_settings_dialog.dart—targetOptionsfor room target language - Course creation:
course_language_filter.dart—unlocalizedTargetOptions
Models
LanguageModel— core model withlangCode,displayName,l2Support,script,localeEmoji,voicesL2SupportEnum—na,alpha,beta,fullwith localized display strings and badge renderingLanguageArc— L1→L2 pair, constructed from user settings
Conventions
- Display names are localized via
getDisplayName(context)using l10n keys, with fallback to CMSlanguage_name - Regional variants show
localeEmojiin place of parenthesized region: "Portuguese 🇧🇷" instead of "Portuguese (Brazil)" langCodeShortstrips the territory:en-US→en- RTL detection uses a hardcoded list in
LanguageConstants.rtlLanguageCodes
Future Work
(No linked issues yet.)