All UI strings in ErgoKawsay are centralized inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Cristiang1021/ErgoKawsay/llms.txt
Use this file to discover all available pages before exploring further.
translations.yaml. A Python generator script reads the YAML and writes a Dart constant class. This approach keeps translations in plain text, making them reviewable and editable by translators, educators, and linguists without any knowledge of Dart or Flutter.
File Layout
| File | Role |
|---|---|
translations.yaml | Source of truth for all Spanish and Kichwa strings |
tools/gen_translations.py | Python 3 script that reads the YAML and writes tr.dart |
lib/core/localization/tr.dart | Auto-generated Dart constant class — do not edit manually |
YAML Format
Each UI string is nested under a feature namespace. The leaf node holdses and kichwa sub-keys. Nesting can be as deep as needed to reflect the feature hierarchy:
active_breaks.neck_rotation becomes activeBreaksNeckRotation, and the two variants are suffixed Es and Qu.
Generated Dart Output
The generator writeslib/core/localization/tr.dart as an abstract final class Tr with static const String fields and static helper methods:
- Two
static const Stringfields (EsandQusuffixes) - One static method that accepts
bool isKichwaand delegates topick()
Adding a New String
Add the key with both language values
Place the new key under the appropriate feature namespace. Both
es and kichwa sub-keys are required — the generator will fail if either is missing:Run the generator
From the project root:The script prints the number of entries written and overwrites
lib/core/localization/tr.dart.Generator Script
The script attools/gen_translations.py uses Python 3 and PyYAML. It:
- Reads
translations.yamlfrom the project root. - Recursively walks the
translations:tree, collecting leaf nodes that have bothesandkichwakeys. - Converts the YAML key path (e.g.,
['active_breaks', 'neck_rotation']) to a camelCase Dart identifier (activeBreaksNeckRotation). - Writes
lib/core/localization/tr.dartwith theabstract final class Trbody.
Translation Review Process
translations.yaml is plain text and version-controlled alongside the source code. Translators can review and update strings without opening an IDE:
- Spanish strings provide the reference meaning.
- Kichwa translations were developed in the context of the ESPOCH academic project, using vocabulary appropriate for the Andean pedagogical context (e.g.,
"Alli kawsay"for well-being,"Yachachik"for teacher).
translations.yaml changes, have a Kichwa-speaking reviewer approve the strings, then regenerate tr.dart as a follow-up commit.
Locale Switching at Runtime
LocaleController.setLocale(String code) switches all UI strings immediately. The controller persists the choice to StorageService and calls notifyListeners(), which triggers a full rebuild of MaterialApp with the new Locale. No app restart is required.
Tr constants are resolved at build time (not compile time), the widget tree re-reads the correct string for the new locale on its next build() call.