Commit 5517e786 authored by Vitaliy Vashchenko's avatar Vitaliy Vashchenko

#784 Text translate depending on locale.

parent 75d9d221
......@@ -242,8 +242,6 @@ public class DesktopLauncher extends Application {
private Parent getLauncherLayoutPane(Stage primaryStage){
// TODO: 12/1/17 launcher icon
// TODO: 12/1/17 change text on locale
// TODO: 12/1/17 consts
Pane pane = new Pane();
VBox mainVBox = new VBox();
......@@ -281,16 +279,15 @@ public class DesktopLauncher extends Application {
HBox fullscreenHBox = new HBox();
verticalBox.setSpacing(20);
Label resolutionLabel = new Label("Resolution");
resolutionLabel.setPadding(new Insets(0, 50, 0, 0));
Label resolutionLabel = new Label(LauncherLocalizedTextDefinition.getLocaliziedText(LauncherLocalizedTextDefinition.RESOLUTION));
resolutionLabel.setPrefWidth(150);
ChoiceBox resolutionChoiceBox = new ChoiceBox();
resolutionChoiceBox.setPrefWidth(150);
resolutionChoiceBox.getItems().addAll(WindowsResolution.getFittingResolutions());
resolutionChoiceBox.getSelectionModel().select(0);
resolutionChoiceBox.setId(RESOLUTION_CHOICE_ID);
Label fullscreenLabel = new Label("Fullscreen");
fullscreenLabel.setPadding(new Insets(0, 50, 0, 0));
Label fullscreenLabel = new Label(LauncherLocalizedTextDefinition.getLocaliziedText(LauncherLocalizedTextDefinition.FULLSCREEN));
fullscreenLabel.setPrefWidth(150);
CheckBox fullscreenCheckBox = new CheckBox();
fullscreenCheckBox.setMnemonicParsing(false);
fullscreenCheckBox.setId(FULLSCREEN_CHECKBOX_ID);
......@@ -306,7 +303,7 @@ public class DesktopLauncher extends Application {
private BorderPane createLaunchButtonBorderPane(Stage primaryStage, Parent pane){
BorderPane buttonBorderPane = new BorderPane();
Button launchButton = new Button("Run");
Button launchButton = new Button(LauncherLocalizedTextDefinition.getLocaliziedText(LauncherLocalizedTextDefinition.LAUNCH));
launchButton.setMnemonicParsing(false);
launchButton.prefWidth(50);
launchButton.prefHeight(45);
......@@ -327,5 +324,30 @@ public class DesktopLauncher extends Application {
return buttonBorderPane;
}
enum LauncherLocalizedTextDefinition {
FULLSCREEN("Celá obrazovka", "Vollbild", "Celá obrazovka"),
RESOLUTION("Rozlišení", "Auflösung", "Rozlíšenie"),
LAUNCH("Spustit", "Starten", "Začať");
private String cs, de, sk;
LauncherLocalizedTextDefinition(String cs, String de, String sk) {
this.cs = cs;
this.de = de;
this.sk = sk;
}
public static String getLocaliziedText(LauncherLocalizedTextDefinition localizedTextDefinition) {
switch (Locale.getDefault().getLanguage()) {
case "sk":
return localizedTextDefinition.sk;
case "de":
return localizedTextDefinition.de;
default:
return localizedTextDefinition.cs;
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment