On Wednesday, November 8, 2017 at 12:04:53 PM UTC+1, Amir Norozi wrote:
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: https://github.com/gwtproject/gwt/blob/2.8.2/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseShell.java#L197-L201 and https://github.com/gwtproject/gwt/blob/2.8.2/samples/showcase/src/com/google/gwt/sample/showcase/client/content/popups/CwDialogBox.java#L179-L186 (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: https://github.com/gwtproject/gwt/blob/2.8.2/samples/showcase/src/com/google/gwt/sample/showcase/client/Showcase.java#L244 (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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment