Changement de langue

This commit is contained in:
nawfe 2020-05-07 19:49:38 +02:00
parent 892dd6da73
commit 05c2b496a2
3 changed files with 12 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

@ -26,7 +26,7 @@ public class MenuJoueurController implements Initializable{
public void changeZoneToScrollPaneJoueur(MouseEvent me) throws IOException {
final URL fxmlURL = getClass().getResource("/ihm/ressources/ScrollPaneJoueur.fxml");
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.ENGLISH);
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", ParametreController.LaLangue);
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
AnchorPane bp = fxmlLoader.load();
ImageView iv = ((ImageView)me.getSource());

View File

@ -28,6 +28,7 @@ public class ParametreController implements Initializable {
private CheckBox clair;
@FXML
private ComboBox<String> langues;
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;
@ -63,6 +64,12 @@ public class ParametreController implements Initializable {
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) {
@ -138,7 +145,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();