Page 1 of 1

How to get locale text orientation

PostPosted: Tue Mar 26, 2013 3:27 pm
by rossent
Hi all,

Servoy currently has option at the solution level to set the text orientation. One of the options is "locale specific" - this is exactly what we need.
However consider this case: in left-to-right locales, we need the labels to be on the left-hand side of the fields which they describe. In right-to-left locales, we need to "flip" that layout so that the labels are on the right-hand side of the associated fields. In order to be able to do that, we need a programmatic way to determine what the text orientation of the current locale is. I could not find a way to do that in Servoy - I was looking for something like application.getCurrentTextOrientation() or i18n.getLocaleTextOrientation(locale). What am I missing?

Re: How to get locale text orientation

PostPosted: Thu Apr 04, 2013 3:17 pm
by Andrei Costescu
There is no such method currently.
You could use something like:
Code: Select all
application.output(java.awt.ComponentOrientation.getOrientation(new java.util.Locale(i18n.getCurrentLanguage(), i18n.getCurrentCountry())).isLeftToRight());

SVY-860 is a case about changing form layout automatically.

Re: How to get locale text orientation

PostPosted: Thu Apr 04, 2013 4:56 pm
by rossent
We will need such method to be added because it will be needed for other things as well - for example, depending on the text orientation we may need to add a form to the left or to the right side of a split panel at runtime. I will file a case for that