This content has been marked as final. Show 3 replies
The short answer is - no you can't.1 person found this helpful
The longer answer is - you should organize your code in such a way that you
can re-initialize your UI more than once. If your model is strictly decoupled
from your UI, this should not be a problem.
Hi,1 person found this helpful
Another solution would be to declare a property containing the internationalized string in your controller, and bind your UI to that.
When you change your resource bundle, update the properties in your controller and your UI will reflect the change.
I'm not sure if I'd do it that way though. If you have only a couple of internationalized strings in your FXML that might be workable.
If you have a lot of them, it might get much more difficult to maintain.
As MiPa says - it might be easier to throw away the old nodes and simply reload & reinitialize the FXML.
Hi MiPa, Daniel,
thanks for clarification I filed a request on jira describing this functionality as I think that it makes sense to have it in the API for several reasons (http://javafx-jira.kenai.com/browse/RT-26065)
@Daniel: I took a similar approach as workaround, where reloading the whole view (with all Nodes) was not possible and just to heavy. I have a ResouceBundle-Property and directly reset the texts of the controls when the ResourceBundle changes, that is one indirection less. Anyway: I generally like the i18n part of FXML and the tool support in ScenceBuilder, but it still feels odd to have to do this workaround in order to achieve what I think is nothing exotic but a common use case in the i18n context.