Issue
One can set ResourceBundle
in a Java class using code below.
FXMLLoader loader = new FXMLLoader(getClass().getResource("my_view.fxml"));
loader.setResources(MyRes.getBundle());
//Node myNode = (Node) loader.load();
Is it possible to specify ResourceBundle in FXML file itself?
Solution
From Introduction to FXML:
<fx:include>
also supports attributes for specifying the name of the resource bundle that should be used to localize the included content, as well as the character set used to encode the source file.<fx:include source="filename" resources="resource_file" charset="utf-8"/>
Not sure about the situation where it is not an included file as I didn't see the documentation on that (from some quick tests, I don't think it's possible, though I could be wrong).
Answered By - jewelsea
Answer Checked By - Robin (JavaFixing Admin)