Fix some i18n issues

This commit is contained in:
Roland Geider
2026-05-25 13:52:55 +02:00
parent 34b1fa6a86
commit bcfe836ce7
4 changed files with 33 additions and 18 deletions

View File

@@ -442,11 +442,14 @@
"@noNutritionalPlans": {
"description": "Message shown when the user has no nutritional plans"
},
"manageLists": "Manage lists",
"@manageLists": {
"description": "Label for the button to manage ingredient lists"
},
"clearSearchTerm": "Clear search term (text)",
"@clearSearchTerm": {
"description": "Tooltip for the icon-button that clears the ingredient search text field"
},
"ingredients": "Ingredients",
"@ingredients": {
"description": "Plural title for the ingredients overview screen"
},
"onlyLogging": "Only track calories",
"onlyLoggingHelpText": "Check the box if you only want to log your calories and don't want to setup a detailed nutritional plan with specific meals",
"goalMacro": "Macro goals",
@@ -563,8 +566,8 @@
"@timeStartAhead": {},
"ingredient": "Ingredient",
"@ingredient": {
"description": "Title for the ingredients screen"
},
"description": "Singular label for an ingredient"
},
"energy": "Energy",
"@energy": {
"description": "Energy in a meal, ingredient etc. e.g. in kJ"
@@ -1363,8 +1366,8 @@
"description": "Heading for the Nutri-Score slider in the ingredient search filter dialog"
},
"nutriscoreValue": "Nutri-Score:",
"@filterNutriscore": {
"description": "label for Nutri-Score(nutriscore) for.eg, in subtitle of ingredient custom lists"
"@nutriscoreValue": {
"description": "Inline label prefixing a Nutri-Score value, e.g. in the subtitle of a custom ingredient list entry"
},
"filterNutriscoreOff": "Off",
"@filterNutriscoreOff": {

View File

@@ -122,10 +122,24 @@ final class IngredientNotifier extends _$IngredientNotifier {
}
}
/// Trigger ingredient search flow by reacting to filter changes.
final searchedIngredientsProvider = FutureProvider<List<Ingredient>>((ref) async {
/// Debounce window applied to the search-term keystrokes
const _searchDebounce = Duration(milliseconds: 350);
/// Triggers an ingredient search whenever the filter state changes, debounced
/// to avoid one server request per keystroke.
final searchedIngredientsProvider = FutureProvider.autoDispose<List<Ingredient>>((ref) async {
final filters = ref.watch(ingredientFiltersSyncProvider);
// Wait for the debounce window. If the filters change again (or the
// provider is disposed) before the delay elapses, abort this run so we
// don't fire a request for an intermediate keystroke.
var disposed = false;
ref.onDispose(() => disposed = true);
await Future.delayed(_searchDebounce);
if (disposed) {
throw StateError('search debounced');
}
// search logic handles the Online/Offline routing
return ref
.read(ingredientProvider.notifier)

View File

@@ -52,10 +52,7 @@ class _IngredientsScreenState extends ConsumerState<IngredientsScreen> {
return Scaffold(
appBar: AppBar(
title: Text(
'${i18n.ingredient}'
's',
),
title: Text(i18n.ingredients),
),
body: WidescreenWrapper(
child: Column(

View File

@@ -36,16 +36,17 @@ class NutritionalPlansScreen extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final i18n = AppLocalizations.of(context);
return Scaffold(
appBar: AppBar(
title: Text(AppLocalizations.of(context).nutritionalPlans),
title: Text(i18n.nutritionalPlans),
actions: [
PopupMenuButton(
PopupMenuButton<_NutritionalPlansAppBarOptions>(
itemBuilder: (context) {
return [
const PopupMenuItem<_NutritionalPlansAppBarOptions>(
PopupMenuItem<_NutritionalPlansAppBarOptions>(
value: _NutritionalPlansAppBarOptions.list,
child: Text('ingredient list'), // TODO: i10n
child: Text(i18n.ingredients),
),
];
},