1

This is a follow up question to this question:

JavaFX title bar RTL not supported?

I just learned how to localize the string in an app I'm building. The language I want to add support to is an RTL language.

Is the setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT); the formal way to support RTL? Do I need to check everywhere in my code my locale and then set the node orientation accordingly? And what if I use FXML for my layout and not Java code?

Isn't there a simpler way to support RTL and make the application automatically change the orientation to some controls of my choosing with setting a property or something and not using that setNodeOrientation directly?

thehennyy
  • 4,020
  • 1
  • 22
  • 31
JJ Ab
  • 492
  • 4
  • 15
  • You can always set Node Orientation to the parent and all the children will take the same orientation. Additionally, you can also set the Orientation from the FXML. – ItachiUchiha Nov 09 '15 at 08:48
  • I do not understand your question on locale, can you explain it? – ItachiUchiha Nov 09 '15 at 08:51
  • When using rtl language, some controls (usually with text) might appear on different sides. for example, you might put some english menus on the left since you read english from left to right, but that menu should appear on the right when using an RTL language. – JJ Ab Nov 09 '15 at 09:17
  • If you need to apply few specific settings for particular Nodes, you will have manually set them on each one of them. If all of them have a parent, you can apply it to the parent, other than that I cannot see any other way of achieving it. – ItachiUchiha Nov 09 '15 at 09:25
  • And there isn't a property you can set on the parent like "automatic orientation" (or something like that), which can be set in the FXML and which will automatically detect the locale and then decide on its own the orientation without me setting it in the code? – JJ Ab Nov 09 '15 at 09:31
  • I am afraid there isn't any such property that I am aware of, but you can definitely do this in code. Check for the locale that is used and set the orientation. It will be a one time investment for the application and imo, its worth it. – ItachiUchiha Nov 09 '15 at 10:09
  • By the way, do you know what should be the language property's file name for hebrew? I tried name_iw.properties but that didn't work – JJ Ab Nov 09 '15 at 11:26
  • You may want to have a look at [this thread](http://stackoverflow.com/questions/10143392/javafx-2-and-internationalization). – ItachiUchiha Nov 09 '15 at 17:59

0 Answers0