1
0
mirror of https://github.com/klmp200/sarl-fireworks.git synced 2024-11-25 02:24:28 +00:00

Internationalisation

This commit is contained in:
Antoine Bartuccio 2017-06-13 10:22:19 +02:00
parent 2256128c81
commit 8cece71f8f
5 changed files with 30 additions and 7 deletions

View File

@ -10,18 +10,18 @@
<Pane fx:id="main_pane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="608.0" prefWidth="933.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="io.sarl.demos.fireworks.gui.FXMLViewerController"> <Pane fx:id="main_pane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="608.0" prefWidth="933.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="io.sarl.demos.fireworks.gui.FXMLViewerController">
<children> <children>
<Canvas fx:id="draw_zone" height="583.0" layoutX="199.0" layoutY="13.0" rotate="180.0" width="715.0" /> <Canvas fx:id="draw_zone" height="583.0" layoutX="199.0" layoutY="13.0" rotate="180.0" width="715.0" />
<Button fx:id="setup_button" layoutX="26.0" layoutY="45.0" mnemonicParsing="false" onAction="#actionSetup" text="Setup" /> <Button fx:id="setup_button" layoutX="26.0" layoutY="45.0" mnemonicParsing="false" onAction="#actionSetup" text="%SetupButtonText" />
<Button fx:id="launch_button" disable="true" layoutX="26.0" layoutY="89.0" mnemonicParsing="false" onAction="#actionLaunch" text="Launch" /> <Button fx:id="launch_button" disable="true" layoutX="26.0" layoutY="89.0" mnemonicParsing="false" onAction="#actionLaunch" text="%LaunchButtonText" />
<AnchorPane layoutX="30.0" layoutY="145.0"> <AnchorPane layoutX="30.0" layoutY="145.0">
<children> <children>
<ScrollBar fx:id="gravity_input" max="3.0" onMouseEntered="#actionGravityDisplay" prefHeight="17.0" prefWidth="159.0" unitIncrement="0.1" value="0.5" /> <ScrollBar fx:id="gravity_input" max="3.0" onMouseEntered="#actionGravityDisplay" prefHeight="17.0" prefWidth="159.0" unitIncrement="0.1" value="0.5" />
<Label fx:id="gravity_display" layoutX="113.0" layoutY="17.0" prefHeight="17.0" prefWidth="46.0" text="0,5" /> <Label fx:id="gravity_display" layoutX="113.0" layoutY="17.0" prefHeight="17.0" prefWidth="46.0" text="0,5" />
<Label layoutY="17.0" prefHeight="17.0" prefWidth="46.0" text="gravity" /> <Label layoutY="17.0" prefHeight="17.0" prefWidth="46.0" text="%GravityLabelText" />
</children> </children>
</AnchorPane> </AnchorPane>
<AnchorPane layoutX="27.0" layoutY="255.0"> <AnchorPane layoutX="27.0" layoutY="255.0">
<children> <children>
<Label layoutX="4.0" layoutY="17.0" text="fire quantity" /> <Label layoutX="4.0" layoutY="17.0" text="%FireQuantityLabelText" />
<Label fx:id="fire_quantity_display" layoutX="117.0" layoutY="17.0" prefHeight="17.0" prefWidth="46.0" text="30" /> <Label fx:id="fire_quantity_display" layoutX="117.0" layoutY="17.0" prefHeight="17.0" prefWidth="46.0" text="30" />
<ScrollBar fx:id="fire_quantity_input" layoutX="4.0" max="50.0" min="5.0" onMouseEntered="#actionFireQuantityDisplay" prefHeight="17.0" prefWidth="159.0" value="30.0" /> <ScrollBar fx:id="fire_quantity_input" layoutX="4.0" max="50.0" min="5.0" onMouseEntered="#actionFireQuantityDisplay" prefHeight="17.0" prefWidth="159.0" value="30.0" />
</children> </children>
@ -29,10 +29,10 @@
<AnchorPane layoutX="30.0" layoutY="199.0"> <AnchorPane layoutX="30.0" layoutY="199.0">
<children> <children>
<ScrollBar fx:id="rocket_quantity_input" max="40.0" min="1.0" onMouseEntered="#actionRocketQuantityDisplay" prefHeight="17.0" prefWidth="159.0" value="20.0" /> <ScrollBar fx:id="rocket_quantity_input" max="40.0" min="1.0" onMouseEntered="#actionRocketQuantityDisplay" prefHeight="17.0" prefWidth="159.0" value="20.0" />
<Label layoutY="20.0" text="rocket quantity" /> <Label layoutY="20.0" text="%RocketQuantityLabelText" />
<Label fx:id="rocket_quantity_display" layoutX="113.0" layoutY="20.0" prefHeight="17.0" prefWidth="46.0" text="20" /> <Label fx:id="rocket_quantity_display" layoutX="113.0" layoutY="20.0" prefHeight="17.0" prefWidth="46.0" text="20" />
</children> </children>
</AnchorPane> </AnchorPane>
<Button fx:id="stop_button" disable="true" layoutX="117.0" layoutY="89.0" mnemonicParsing="false" onAction="#actionStop" text="Stop" /> <Button fx:id="stop_button" disable="true" layoutX="117.0" layoutY="89.0" mnemonicParsing="false" onAction="#actionStop" text="%StopButtonText" />
</children> </children>
</Pane> </Pane>

View File

@ -0,0 +1,7 @@
TITLE=SARL Demo: Fireworks Animation
SetupButton=Configure
LaunchButton=Launch
StopButton=Stop
GravityLabel=Gravity
RocketQuantityLabel=Rocket quantity
FireQuantityLabel=Fire quantity

View File

@ -2,6 +2,7 @@ package io.sarl.demos.fireworks
import io.sarl.demos.fireworks.gui.FXMLViewerController import io.sarl.demos.fireworks.gui.FXMLViewerController
import java.net.URL import java.net.URL
import java.util.ResourceBundle
import javafx.application.Application import javafx.application.Application
import javafx.fxml.FXMLLoader import javafx.fxml.FXMLLoader
import javafx.fxml.JavaFXBuilderFactory import javafx.fxml.JavaFXBuilderFactory
@ -13,16 +14,20 @@ class FireworksFXApplication extends Application {
private var loader : FXMLLoader private var loader : FXMLLoader
private val bundle : ResourceBundle = ResourceBundle.getBundle(
FireworksFXApplication.getPackage.name.replaceAll("\\.", "/") + "/" + FireworksFXApplication.simpleName);
@Override @Override
public def start(stage : Stage) throws Exception { public def start(stage : Stage) throws Exception {
var location : URL = getClass().getResource("FireworksFXApplication.fxml"); var location : URL = getClass().getResource("FireworksFXApplication.fxml");
loader = new FXMLLoader(); loader = new FXMLLoader();
loader.setLocation(location); loader.setLocation(location);
loader.setBuilderFactory(new JavaFXBuilderFactory()); loader.setBuilderFactory(new JavaFXBuilderFactory());
loader.resources = bundle
var root : Parent = loader.load(location.openStream()) as Parent; var root : Parent = loader.load(location.openStream()) as Parent;
var scene : Scene = new Scene(root); var scene : Scene = new Scene(root);
scene.getStylesheets().add(getClass().getResource("ViewerController.css").toExternalForm); scene.getStylesheets().add(getClass().getResource("ViewerController.css").toExternalForm);
stage.setTitle("SARL Demo: Fireworks Animation"); stage.setTitle(bundle.getString("TITLE"))
stage.setScene(scene); stage.setScene(scene);
stage.show(); stage.show();
} }

View File

@ -0,0 +1,7 @@
TITLE=SARL Démo: Animation de feux d'artifice
SetupButtonText=Configurer
LaunchButtonText=Lancer
StopButtonText=Stop
GravityLabelText=Gravité
RocketQuantityLabelText=Quantité de roquettes
FireQuantityLabelText=Quantité de feu

View File

@ -114,6 +114,10 @@ class FXMLViewerController implements EventListener {
Firework.main(this); Firework.main(this);
launched = true; launched = true;
areaCreated = false; areaCreated = false;
gravity_input.setDisable(true)
fire_quantity_input.setDisable(true)
rocket_quantity_input.setDisable(true)
setup_button.setDisable(true)
} }
this.ispace.emit(ievent); this.ispace.emit(ievent);
} }