javafx Internationalization in JavaFX Controller


Example

A Resource bundles contain locale-specific objects. You can pass the bundle to the FXMLLoader during its creation. The controller must implement Initializable interface and override initialize(URL location, ResourceBundle resources) method. The second parameter to this method is ResourceBundle which is passed from the FXMLLoader to the controller and can be used by the controller to further translate texts or modify other locale-dependant information.

public class MyController implements Initializable {

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        label.setText(resources.getString("country"));
    }
}