From 638220bb07434659b8e871006a6e5c5fb37c1669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Rasie=C5=84ski?= Date: Wed, 21 Jan 2026 13:51:11 +0100 Subject: [PATCH 01/49] Fixed lang in main menu --- .../java/client/scenes/FoodpalApplicationCtrl.java | 6 ++++++ .../java/client/scenes/LangSelectMenuCtrl.java | 1 + client/src/main/resources/locale/lang.properties | 6 +++++- .../src/main/resources/locale/lang_en.properties | 8 +++++--- .../src/main/resources/locale/lang_nl.properties | 14 ++++++++------ .../src/main/resources/locale/lang_pl.properties | 8 +++++--- .../src/main/resources/locale/lang_tok.properties | 2 ++ .../src/main/resources/locale/lang_tr.properties | 4 ++++ 8 files changed, 36 insertions(+), 13 deletions(-) diff --git a/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java b/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java index e7cb0df..fb24069 100644 --- a/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java +++ b/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java @@ -84,6 +84,9 @@ public class FoodpalApplicationCtrl implements LocaleAware { @FXML private ToggleButton favouritesOnlyToggle; + @FXML + private Button manageIngredientsButton; + private List allRecipes = new ArrayList<>(); @FXML @@ -290,6 +293,9 @@ public class FoodpalApplicationCtrl implements LocaleAware { removeRecipeButton.setText(getLocaleString("menu.button.remove.recipe")); cloneRecipeButton.setText(getLocaleString("menu.button.clone")); recipesLabel.setText(getLocaleString("menu.label.recipes")); + + favouritesOnlyToggle.setText(getLocaleString("menu.button.favourites")); + manageIngredientsButton.setText(getLocaleString("menu.button.ingredients")); } @Override diff --git a/client/src/main/java/client/scenes/LangSelectMenuCtrl.java b/client/src/main/java/client/scenes/LangSelectMenuCtrl.java index 8cb6ddf..0dc719a 100644 --- a/client/src/main/java/client/scenes/LangSelectMenuCtrl.java +++ b/client/src/main/java/client/scenes/LangSelectMenuCtrl.java @@ -41,6 +41,7 @@ public class LangSelectMenuCtrl implements LocaleAware { String lang = langSelectMenu.getSelectionModel().getSelectedItem(); logger.info("Switching locale to " + lang); manager.setLocale(Locale.of(lang)); + initializeComponents(); } @Override diff --git a/client/src/main/resources/locale/lang.properties b/client/src/main/resources/locale/lang.properties index df67ba5..00bfea8 100644 --- a/client/src/main/resources/locale/lang.properties +++ b/client/src/main/resources/locale/lang.properties @@ -16,6 +16,8 @@ menu.label.preparation=Preparation menu.button.add.recipe=Add Recipe menu.button.add.ingredient=Add Ingredient menu.button.add.step=Add Step +menu.button.favourites=Favourites +menu.button.ingredients=Ingredients menu.button.remove.recipe=Remove Recipe menu.button.remove.ingredient=Remove Ingredient @@ -25,10 +27,12 @@ menu.button.edit=Edit menu.button.clone=Clone menu.button.print=Print recipe +menu.search=Search... + menu.label.selected-langs=Languages lang.en.display=English lang.nl.display=Dutch lang.pl.display=Polish lang.tok.display=toki pona -lang.tr.display=T\u00FCrk\u00E7e \ No newline at end of file +lang.tr.display=Turkish \ No newline at end of file diff --git a/client/src/main/resources/locale/lang_en.properties b/client/src/main/resources/locale/lang_en.properties index 2344205..00bfea8 100644 --- a/client/src/main/resources/locale/lang_en.properties +++ b/client/src/main/resources/locale/lang_en.properties @@ -16,6 +16,8 @@ menu.label.preparation=Preparation menu.button.add.recipe=Add Recipe menu.button.add.ingredient=Add Ingredient menu.button.add.step=Add Step +menu.button.favourites=Favourites +menu.button.ingredients=Ingredients menu.button.remove.recipe=Remove Recipe menu.button.remove.ingredient=Remove Ingredient @@ -30,7 +32,7 @@ menu.search=Search... menu.label.selected-langs=Languages lang.en.display=English -lang.nl.display=Nederlands -lang.pl.display=Polski +lang.nl.display=Dutch +lang.pl.display=Polish lang.tok.display=toki pona -lang.tr.display=T\u00FCrk\u00E7e \ No newline at end of file +lang.tr.display=Turkish \ No newline at end of file diff --git a/client/src/main/resources/locale/lang_nl.properties b/client/src/main/resources/locale/lang_nl.properties index 0a65cf8..813bcb9 100644 --- a/client/src/main/resources/locale/lang_nl.properties +++ b/client/src/main/resources/locale/lang_nl.properties @@ -10,15 +10,17 @@ button.ok=Ok button.cancel=Annuleren menu.label.recipes=Recepten -menu.label.ingredients=Ingredinten +menu.label.ingredients=Ingrediënten menu.label.preparation=Bereiding menu.button.add.recipe=Recept toevoegen -menu.button.add.ingredient=Ingredint toevoegen +menu.button.add.ingredient=Ingrediënt toevoegen menu.button.add.step=Stap toevoegen +menu.button.favourites=Favorieten +menu.button.ingredients=Ingrediënten menu.button.remove.recipe=Recept verwijderen -menu.button.remove.ingredient=Ingredint verwijderen +menu.button.remove.ingredient=Ingrediënt verwijderen menu.button.remove.step=Stap verwijderen menu.button.edit=Bewerken @@ -28,8 +30,8 @@ menu.button.print=Recept afdrukken menu.label.selected-langs=Talen menu.search=Zoeken... -lang.en.display=English +lang.en.display=Engels lang.nl.display=Nederlands -lang.pl.display=Polski +lang.pl.display=Pools lang.tok.display=toki pona -lang.tr.display=T\u00FCrk\u00E7e \ No newline at end of file +lang.tr.display=Turks \ No newline at end of file diff --git a/client/src/main/resources/locale/lang_pl.properties b/client/src/main/resources/locale/lang_pl.properties index 841d9b8..2712074 100644 --- a/client/src/main/resources/locale/lang_pl.properties +++ b/client/src/main/resources/locale/lang_pl.properties @@ -16,6 +16,8 @@ menu.label.preparation=Przygotowanie menu.button.add.recipe=Dodaj przepis menu.button.add.ingredient=Dodaj składnik menu.button.add.step=Dodaj instrukcję +menu.button.favourites=Ulubione +menu.button.ingredients=Składniki menu.button.remove.recipe=Usuń przepis menu.button.remove.ingredient=Usuń składnik @@ -29,8 +31,8 @@ menu.search=Szukaj... menu.label.selected-langs=Języki -lang.en.display=English -lang.nl.display=Nederlands +lang.en.display=Inglisz +lang.nl.display=Holenderski lang.pl.display=Polski lang.tok.display=toki pona -lang.tr.display=T\u00FCrk\u00E7e \ No newline at end of file +lang.tr.display=Turecki \ No newline at end of file diff --git a/client/src/main/resources/locale/lang_tok.properties b/client/src/main/resources/locale/lang_tok.properties index 1b44b6a..18bb9b1 100644 --- a/client/src/main/resources/locale/lang_tok.properties +++ b/client/src/main/resources/locale/lang_tok.properties @@ -16,6 +16,8 @@ menu.label.preparation=nasin pi pali moku ni menu.button.add.recipe=o pali e lipu moku sin menu.button.add.ingredient=o pali e kipisi moku sin menu.button.add.step=o pali e nasin pi pali moku ni +menu.button.favourites=ijo pi pona mute tawa sina +menu.button.ingredients=kipisi moku mute menu.button.remove.recipe=o weka e lipu moku ni menu.button.remove.ingredient=o weka e kipisi moku ni diff --git a/client/src/main/resources/locale/lang_tr.properties b/client/src/main/resources/locale/lang_tr.properties index 1b4ceb6..e0700ff 100644 --- a/client/src/main/resources/locale/lang_tr.properties +++ b/client/src/main/resources/locale/lang_tr.properties @@ -16,6 +16,8 @@ menu.label.preparation=Haz\u0131rl\u0131k menu.button.add.recipe=Tarif Ekle menu.button.add.ingredient=Malzeme Ekle menu.button.add.step=Ad\u0131m Ekle +menu.button.favourites=Favoriler +menu.button.ingredients=Malzemeler menu.button.remove.recipe=Tarifi Sil menu.button.remove.ingredient=Malzemeyi Sil @@ -25,6 +27,8 @@ menu.button.edit=D\u00FCzenle menu.button.clone=Kopyala menu.button.print=Tarifi Yazd\u0131r +menu.search=Arama... + menu.label.selected-langs=Diller lang.en.display=\u0130ngilizce From 8989cab770845ec44502d5e86b0ae365217e13bf Mon Sep 17 00:00:00 2001 From: Mei Chang van der Werff Date: Wed, 21 Jan 2026 14:21:30 +0100 Subject: [PATCH 02/49] A favourited recipe now becomes blue in text --- .../main/java/client/scenes/FoodpalApplicationCtrl.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java b/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java index e7cb0df..420ac95 100644 --- a/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java +++ b/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java @@ -40,6 +40,7 @@ import javafx.scene.control.ListCell; import javafx.scene.control.ListView; import javafx.scene.control.TextInputDialog; import javafx.scene.control.ToggleButton; +import javafx.scene.paint.Color; import org.apache.commons.lang3.NotImplementedException; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; @@ -200,6 +201,12 @@ public class FoodpalApplicationCtrl implements LocaleAware { } //gives star in front fav items boolean fav = config.isFavourite(item.getId()); setText((fav ? "★ " : "") + item.getName()); + + if(fav){ + setTextFill(Color.BLUE); + }else{ + setTextFill(Color.BLACK); + } } }); // When your selection changes, update details in the panel From 969d052230578fc475d8c206fababedf417386ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Rasie=C5=84ski?= Date: Wed, 21 Jan 2026 14:34:57 +0100 Subject: [PATCH 03/49] translated ingredients menu --- .../client/scenes/FoodpalApplicationCtrl.java | 2 +- .../scenes/Ingredient/IngredientListCtrl.java | 37 +++++++++++++++---- .../scenes/nutrition/IngredientList.fxml | 10 ++--- .../src/main/resources/locale/lang.properties | 7 ++++ .../main/resources/locale/lang_en.properties | 7 ++++ .../main/resources/locale/lang_nl.properties | 7 ++++ .../main/resources/locale/lang_pl.properties | 7 ++++ .../main/resources/locale/lang_tok.properties | 7 ++++ .../main/resources/locale/lang_tr.properties | 7 ++++ 9 files changed, 78 insertions(+), 13 deletions(-) diff --git a/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java b/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java index fb24069..1b26009 100644 --- a/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java +++ b/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java @@ -564,7 +564,7 @@ public class FoodpalApplicationCtrl implements LocaleAware { var root = pair.getValue(); var stage = new javafx.stage.Stage(); - stage.setTitle("Nutrition values view"); + stage.setTitle(getLocaleString("menu.ingredients.title")); stage.initModality(javafx.stage.Modality.APPLICATION_MODAL); stage.setScene(new javafx.scene.Scene(root)); stage.showAndWait(); diff --git a/client/src/main/java/client/scenes/Ingredient/IngredientListCtrl.java b/client/src/main/java/client/scenes/Ingredient/IngredientListCtrl.java index dfcd7be..bc1cc97 100644 --- a/client/src/main/java/client/scenes/Ingredient/IngredientListCtrl.java +++ b/client/src/main/java/client/scenes/Ingredient/IngredientListCtrl.java @@ -1,14 +1,13 @@ package client.scenes.Ingredient; import client.scenes.nutrition.NutritionDetailsCtrl; +import client.utils.LocaleAware; +import client.utils.LocaleManager; import client.utils.server.ServerUtils; import commons.Ingredient; import jakarta.inject.Inject; import javafx.fxml.FXML; -import javafx.scene.control.Alert; -import javafx.scene.control.ListCell; -import javafx.scene.control.ListView; -import javafx.scene.control.TextInputDialog; +import javafx.scene.control.*; import javafx.stage.Stage; import java.io.IOException; @@ -19,10 +18,18 @@ import java.util.logging.Logger; //TODO and check for capital letter milk and MILK are seen as different -public class IngredientListCtrl { - +public class IngredientListCtrl implements LocaleAware { private final ServerUtils server; + private final LocaleManager localeManager; private final Logger logger = Logger.getLogger(IngredientListCtrl.class.getName()); + + @FXML + public Label ingredientsLabel; + public Button addButton; + public Button refreshButton; + public Button deleteButton; + public Button closeButton; + @FXML private ListView ingredientListView; @FXML @@ -31,12 +38,28 @@ public class IngredientListCtrl { @Inject public IngredientListCtrl( ServerUtils server, + LocaleManager localeManager, NutritionDetailsCtrl nutritionDetailsCtrl ) { this.server = server; + this.localeManager = localeManager; this.nutritionDetailsCtrl = nutritionDetailsCtrl; } + @Override + public void updateText() { + ingredientsLabel.setText(getLocaleString("menu.label.ingredients")); + addButton.setText(getLocaleString("menu.button.add")); + refreshButton.setText(getLocaleString("menu.button.refresh")); + deleteButton.setText(getLocaleString("menu.button.delete")); + closeButton.setText(getLocaleString("menu.button.close")); + } + + @Override + public LocaleManager getLocaleManager() { + return this.localeManager; + } + @FXML public void initialize() { ingredientListView.setCellFactory(list -> new ListCell<>() { @@ -60,6 +83,7 @@ public class IngredientListCtrl { refresh(); } + @FXML private void addIngredient() { TextInputDialog dialog = new TextInputDialog(); @@ -86,7 +110,6 @@ public class IngredientListCtrl { } } - @FXML private void refresh() { try { diff --git a/client/src/main/resources/client/scenes/nutrition/IngredientList.fxml b/client/src/main/resources/client/scenes/nutrition/IngredientList.fxml index 653beaa..751ed0b 100644 --- a/client/src/main/resources/client/scenes/nutrition/IngredientList.fxml +++ b/client/src/main/resources/client/scenes/nutrition/IngredientList.fxml @@ -15,16 +15,16 @@ -