Language switching from English to Dutch (or vice versa) causes inconsistent UI updates because of three different localization access patterns:
gStrings (S.current) - Static, NON-reactive - 364 usages across 57 filescontext.strings - Reactive via S.maybeOf(context) - used in some viewsS.current direct - Same as gStrings, non-reactiveThe gStrings global getter returns a static snapshot that does NOT rebuild widgets when locale changes. Only context.strings (which uses S.maybeOf(context)) creates a dependency on the Localizations InheritedWidget and triggers rebuilds.
gStrings global accessor entirelygStrings usages to appropriate reactive patterns:context.stringsS strings parameter to label methods_strings getter with context fallbackS.current (acceptable for error responses captured at generation time)S strings parameter to factory methodsBuildContext context parameter to methodslib/l10n/l10n.dart (duplicate of lib/generated/l10n.dart)lib/l10n/intl/messages_all.dart (stale)lib/l10n/intl/messages_en.dart (stale)gStrings usageslib/l10n/globals/g_strings.dart (to be deleted)lib/l10n/l10n.dart (stale duplicate to be deleted)lib/l10n/intl/ directory (stale to be deleted)instructions/how-we-handle-localization.md (documentation update)
Reacties