Here is a line of code which returns the locale:
// lib/data/gallery_options.dart
Locale get locale => _locale ?? deviceLocale;
... which can be accessed like:
// lib\studies\shrine\app.dart
locale: GalleryOptions.of(context).locale,
The problem is the options for locales, i.e. supportedLocales
come from this file:
.dart_tool/flutter_gen/gen_l10n/gallery_localizations.dart
... which looks to be not part of the repository and automatically generated. It is not editable and gets reloaded discarding all changes.
How can I limit the number of locales selectable by the user?
Solved! 😃 Supported locales of settings page are on file lib/pages/settings.dart
and can be limited by modifying this line with this patch:
- var supportedLocales =
- List<Locale>.from(GalleryLocalizations.supportedLocales);
+ var supportedLocales = [
+ const Locale('en'),
+ const Locale('he'),
+ ];
supportedLocales.removeWhere((locale) => locale == deviceLocale);