I am using Struts2 Internationalization to support English & Arabic.
I want to know that is it possible to dynamically or automatically change the position of label which comes before any input (text, date, etc.) when the locale changes?
E.g.
LTR -> English -> First Name – “Input Text Box”
RTL -> Arabic -> “Input Text Box” – أول اسم
Any possible solution for this?
BR
SC
Either (ab)use
java.awt.ComponentOrientation(its source code is pretty trivial though, there are only 4 languages which are RTL, here’s an extract of relevance)
Or put it in a recourcebundle yourself.
And read it as follows
Either way, you can make use of this to change the direction accordingly.
which would end up as
<html dir="ltr">or<html dir="rtl">in generated HTML.