Adds a per-user language override in Settings that takes precedence over
the system locale, fixing #439. Selecting "System default" clears the
override and falls back to the existing localeListResolutionCallback.
Also declares CFBundleLocalizations in the iOS Info.plist so iOS 16+ users
get the native per-app language picker (Settings → wger → Language) as an
alternative entry point.
Implementation mirrors the existing themeMode flow on UserProvider, with
the selected locale persisted in SharedPreferences under PREFS_USER_LOCALE
and matched against AppLocalizations.supportedLocales on load to preserve
script-bearing locales (zh_Hant, pt_BR, ...).
The previous logic didn't consult the app's supportedLocales. For the Android 13 per-app
picker this was fine (the user picked a locale that's also in `locales_config.xml`), but
for users whose primary locale wasn't in the supportedLocales list but whose secondary
one *was*, the app would fall through to English instead of honoring the secondary
Closes#930. The validateLanguage stub in AddExerciseProvider was making
the API call but ignoring the response and always returning false. This
wires it up properly: the method now returns null on success or the
server's error message on a language mismatch (caught from the 400
WgerHttpException). The stepper's onStepContinue is now async-aware for
steps 2 (Description) and 3 (Translation) — it calls validateLanguage
after form validation passes, blocks navigation, and displays the error
inline if the check fails. Mocks regenerated to reflect the return type
change from Future<bool> to Future<String?>.
- added locales_config.xml with supported languages
- linked localeConfig in AndroidManifest.xml
- updated MaterialApp with localeListResolutionCallback for system sync
Mirrors the React refactor in wger-project/react#1237 addressing
Roland's review — the SwitchListTile + conditional Slider pair
expressed one semantic decision ("what grade ceiling?") through two
controls. Folded "Off" into the slider itself:
- Slider stops are now Off | A | B | C | D | E (was A..E, gated by
a SwitchListTile).
- Off position sends no `nutriscoreMax`; A..E map as before.
- Heading changed from "Filter by Nutri-Score" to "Nutri-Score
filter", with a dynamic helper ("No filter" / "<grade> or better").
- Model: `IngredientFilters.nutriscoreMax` is now nullable; removed
`filterNutriscore`. `copyWith` takes a `clearNutriscoreMax` flag
because Dart's `??` cannot distinguish "no argument" from "null".
- Storage collapsed: `saveIngredientNutriscoreMax(null)` removes the
key; `getIngredientNutriscoreMax()` returns `null` when absent.
- Riverpod notifier: removed `toggleNutriscore`; `chooseNutriscoreMax`
now takes `NutriScore?`.
- l10n: removed `filterNutriscoreMax`; added `filterNutriscoreOff`,
`filterNutriscoreNoFilter`, `filterNutriscoreOrBetter` (placeholder).
Tests updated: 61/61 pass.
Adds a "Filter by Nutri-Score" switch and an A–E discrete slider to
the ingredient search filter popover. The worst acceptable grade is
sent to the backend as `nutriscore__lte=<a|b|c|d|e>`, matching the
new filter exposed by wger-project/wger#2295.
- Extend `IngredientFilters` with `filterNutriscore` + `nutriscoreMax`
- Persist both settings through `PreferenceHelper`
- Expose `toggleNutriscore` and `chooseNutriscoreMax` on the riverpod
notifier
- Propagate `nutriscoreMax` through `NutritionPlansProvider.searchIngredient`
- Add English strings `filterNutriscore` / `filterNutriscoreMax`
- Widget tests cover: slider hidden until switch flipped, query emitted
with/without the filter
- Update stale generated Mockito overrides across the four test files
that mock `NutritionPlansProvider` so the new named arg lines up
Refs wger-project/wger#2295