Thursday, March 27, 2014

Re: How to use/force the default locale under certain conditions on runtime?

Thanks for your replay but I don't think this helps me. I need someway to switch the locale on runtime for certain pages, not for the complete app.

Well I think GWT does not provide more than what is described on the linked doc. GWT only has limited support for runtime locales. The following is taken from I18n.gwt.xml:

  <!--
      Set of locales to be selectable at runtime.  Only those which extend
      the locale of the current permutation will actually be included.  Note
      that currently only number/date format constants, locale names, and
      currency data will support runtime locales - everything else will just
      reference the compile-time locale set in the "locale" property.
   -->
  <define-configuration-property name="runtime.locales" is-multi-valued="true"/>

So all your messages / constants with your translations are tied to your permutation at compile time and thus you need to reload your app with the appropriate locale to change the translations (so GWT can pick a different permutation on app start).

If you want to change the locale of a single page you must reload the app for that page and then reload the app again when you leave that page ( = not nice! ). To tell GWT which locale it should load you can use query parameter, cookie, user agent string or the gwt:property meta tag. 

It is probably easier to show the complete app in english until your translation is done for all pages. Using runtime locales you can still show locale specific date/time/currency.

-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment