-
Notifications
You must be signed in to change notification settings - Fork 3
L10n (Localization)
When showing strings to the user, these should usually be translated into that user's language. (We currently support English and German.) To translate these strings, we store localized (≈ translated) variants of that as .arb-files (based on JSON): lib/l10n/l10n_<locale>.arb
. Those strings are then moved into a generated Dart class, which you can access as context.s.my_string_key
.
The naming should roughly follow existing keys: <module>_<widget>_<customIdentifier>
.
When you're done editing an .arb-file, some Dart files need to be re-generated using Flutter Intl. Sometimes that happens automatically, but if context.s.my_string_key
is not available, try:
- Opening the modified
lib/l10n/l10n_<locale>.arb
-file(s) and hitting save. This should trigger the generator (when using VS Code and the Flutter Intl). - Opening
lib/generated/l10n.dart
. This file contains the generated strings and by opening it VS Code sees its updated contents.
Need help? Feel free to contact Jonas Wanke, a former member of the Flutter team at the HPI Schul-Cloud :)