spoke spoke - 1 year ago 184
Java Question

dialog internationalization in javafx

I fount a problem in my code because it translates some words (in this case a button) according to the language of the os. I've searched for solutions but I didn't find anything to fit my case. As far as I've seen bundles are used to translate strings.

Here is my problem explicitly:
enter image description here

My problem is that instead of cancel it writes "Annuler", the french word.

Here is the code for the dialog:

printerSet.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent e) {
ChoiceDialog<String> dialog = new ChoiceDialog<>(
"Dummy Printer", choices);
dialog.setTitle("Choice Dialog");
dialog.setContentText("Choose the printer you want to use:");

Optional<String> result = dialog.showAndWait();
if (result.isPresent()) {
String opt = result.get();
System.out.println("Your choice: " + opt);
printerLabel.setText("Selected Printer: " + opt);


Does anyone know a solution?

Answer Source

Try to provide the following JVM arguments at start-up:

java -Duser.language=en -Duser.country=US ...
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download