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 @@ -