Changement de langue

This commit is contained in:
nawfe 2020-05-08 16:32:00 +02:00
parent 5ac8589818
commit 1b69f11ce7
2 changed files with 13 additions and 5 deletions

View File

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

View File

@ -34,6 +34,7 @@ public class ParametreController implements Initializable {
@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();