我在我的代碼中發現了一個問題,因爲它根據os的語言翻譯了一些單詞(在本例中爲一個按鈕)。我尋找解決方案,但沒有找到適合我的案例。據我所見,bundles用於翻譯字符串。javafx中的對話國際化
我的問題是不是取消它寫道:「更改或取消」,法語單詞。
下面是對話的代碼:
printerSet.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
ChoiceDialog<String> dialog = new ChoiceDialog<>(
"Dummy Printer", choices);
dialog.setTitle("Choice Dialog");
dialog.setHeaderText(null);
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);
}
printButton.setDisable(true);
name.setText("");
code.setText("");
description.setText("");
availability.setText("");
}
});
有誰知道一個解決方案嗎?