Wednesday, November 8, 2017

Re: GWT multilanguage and fix direction

On Wednesday, November 8, 2017 at 12:04:53 PM UTC+1, Amir Norozi wrote:

Hi guys!
I've a GWT project that is many language like french,english and specially farsi and arabic.
I want that when my users click on farsi or arabic then all of elements on my web pages will to be RTL and...
when click on french or english all of them come back to LTR.
please guide me... :)

Assuming you're using GWT I18N here (note that this means reloading the application whenever you want/need to change the locale), you can know if the current locale is RTL (to adapt the UI) by calling LocaleInfo.getCurrentLocale().isRTL(). Some widgets already take that information into account and adapt their layout automatically.
The Showcase sample is a good example; for example: and (notice how almost everything switches to RTL without the need for the anything else in the code besides those two places). The showcase also uses this information to conditionally load different CSS stylesheets on load: (note that it could have used StyleInjector to simplify the code)

You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment