I am currently developing a JavaFX application with Slovak language localization and inside the application I am using an Alert
dialog for showing exceptions wi
For your particular use case, you can add another listener to expandedProperty
which will override the texts shown of "details button":
Platform.runLater(() ->
{
Hyperlink detailsButton = ( Hyperlink ) alert.getDialogPane().lookup( ".details-button" );
alert.getDialogPane().expandedProperty().addListener(
( ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue ) ->
{
detailsButton.setText( newValue ? "My less text" : "My more text" );
});
// trigger listeners
alert.getDialogPane().setExpanded( true );
alert.getDialogPane().setExpanded( false );
});
For more common hack see Localizing JavaFx Controls. From there you need to put the following keys to your custom properties file:
// translate these
Dialog.detail.button.more = Show Details
Dialog.detail.button.less = Hide Details