How to get locale text orientation

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

How to get locale text orientation

Postby rossent » Tue Mar 26, 2013 3:27 pm

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?
Rossen Totev
Argos Software
rossent
 
Posts: 288
Joined: Wed Dec 31, 2008 2:03 pm

Re: How to get locale text orientation

Postby Andrei Costescu » Thu Apr 04, 2013 3:17 pm

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.
Andrei Costescu
Servoy
Andrei Costescu
 
Posts: 1018
Joined: Tue Jun 26, 2007 3:14 pm

Re: How to get locale text orientation

Postby rossent » Thu Apr 04, 2013 4:56 pm

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
Rossen Totev
Argos Software
rossent
 
Posts: 288
Joined: Wed Dec 31, 2008 2:03 pm


Return to How To

Who is online

Users browsing this forum: No registered users and 6 guests

cron