From 1b69f11ce7fa6abb9f6ecc43cebbcb7e469fd3f8 Mon Sep 17 00:00:00 2001 From: nawfe Date: Fri, 8 May 2020 16:32:00 +0200 Subject: [PATCH] Changement de langue --- src/ihm/controller/MenuController.java | 6 +++--- src/ihm/controller/ParametreController.java | 12 ++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/ihm/controller/MenuController.java b/src/ihm/controller/MenuController.java index a76cd25..5e2685d 100644 --- a/src/ihm/controller/MenuController.java +++ b/src/ihm/controller/MenuController.java @@ -42,7 +42,7 @@ public class MenuController implements Initializable{ System.out.println("Passage à l'écran de choix des joueurs"); final URL fxmlURL = getClass().getResource("/ihm/ressources/Choix_joueur.fxml"); - final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE); + final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", ParametreController.LaLangue); final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle); AnchorPane pane = fxmlLoader.load(); Scene scene = new Scene(pane); @@ -60,7 +60,7 @@ public class MenuController implements Initializable{ System.out.println("Passage à l'écran des paramètres"); final URL fxmlURL = getClass().getResource("/ihm/ressources/parametre.fxml"); - final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE); + final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", ParametreController.LaLangue); final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle); Pane pane = fxmlLoader.load(); @@ -82,7 +82,7 @@ public class MenuController implements Initializable{ EffetSonore.playSoundEffect(fileSound1); System.out.println("Passage à l'écran des règles"); final URL fxmlURL = getClass().getResource("/ihm/ressources/Regles.fxml"); - final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE); + final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", ParametreController.LaLangue); final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle); AnchorPane pane = fxmlLoader.load(); Scene scene = new Scene(pane); diff --git a/src/ihm/controller/ParametreController.java b/src/ihm/controller/ParametreController.java index ef19b78..6ddaf64 100644 --- a/src/ihm/controller/ParametreController.java +++ b/src/ihm/controller/ParametreController.java @@ -33,7 +33,8 @@ public class ParametreController implements Initializable { private Slider sliderMusique; @FXML private Slider sliderEffets; - + + public static Locale LaLangue = Locale.FRANCE; public static boolean cbMusiqueCoche = false; // verifi si la checbox musical est coche public static boolean cbSonCoche = false; public static boolean cbClair = false; @@ -74,6 +75,13 @@ public class ParametreController implements Initializable { public void enregistre(MouseEvent mouseEvent) throws IOException, Exception { InputStream fileSound1 = getClass().getResourceAsStream("/ihm/ressources/musique/BEEP1.wav"); + + if(langues.getValue()=="Anglais") { + LaLangue=Locale.ENGLISH; + } + else if(langues.getValue()=="Français") { + LaLangue=Locale.FRANCE; + } // Pour la musique if (fileMusique != null) { @@ -149,7 +157,7 @@ public class ParametreController implements Initializable { // Quitter les paramètres final URL fxmlURL = getClass().getResource("/ihm/ressources/Menu.fxml"); - final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE); + final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", ParametreController.LaLangue); final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle); Pane pane = fxmlLoader.load();