overengineered locale switch
This commit is contained in:
parent
2c75567a7d
commit
c0be17e0b0
2 changed files with 8 additions and 15 deletions
|
|
@ -12,6 +12,7 @@ import client.utils.ServerUtils;
|
|||
import commons.Recipe;
|
||||
|
||||
import jakarta.inject.Inject;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
|
|
@ -234,18 +235,10 @@ public class FoodpalApplicationCtrl implements LocaleAware {
|
|||
|
||||
// Language buttons
|
||||
@FXML
|
||||
private void switchToEnglish() {
|
||||
localeManager.setLocale(Locale.of("en"));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void switchToDutch() {
|
||||
localeManager.setLocale(Locale.of("nl"));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void switchToPolish() {
|
||||
localeManager.setLocale(Locale.of("pl"));
|
||||
private void switchLocale(ActionEvent event) {
|
||||
Button button = (Button)event.getSource();
|
||||
String lang = (String)button.getUserData();
|
||||
localeManager.setLocale(Locale.of(lang));
|
||||
}
|
||||
|
||||
@FXML
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@
|
|||
<buttons>
|
||||
<ToolBar prefHeight="35.0" prefWidth="123.0">
|
||||
<items>
|
||||
<Button fx:id="flagEnButton" minWidth="33.0" onAction="#switchToEnglish" prefHeight="25.0" prefWidth="33.0" text="EN" />
|
||||
<Button fx:id="flagNlButton" onAction="#switchToDutch" text="NL" />
|
||||
<Button fx:id="flagPlButton" onAction="#switchToPolish" text="PL" />
|
||||
<Button fx:id="flagEnButton" minWidth="33.0" onAction="#switchLocale" userData="en" prefHeight="25.0" prefWidth="33.0" text="EN" />
|
||||
<Button fx:id="flagNlButton" onAction="#switchLocale" userData="nl" text="NL" />
|
||||
<Button fx:id="flagPlButton" onAction="#switchLocale" userData="pl" text="PL" />
|
||||
</items>
|
||||
</ToolBar>
|
||||
</buttons>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue