GWT Dynamic Locale

后端 未结 3 991
清歌不尽
清歌不尽 2021-01-03 11:55

I want to set gwt-locale taking user chosen locale with the help of Spring LocaleContextHolder.

public static final String getCurre         


        
3条回答
  •  一生所求
    2021-01-03 12:18

    Use a dynamic host page where you inject the proper .

    Remember the GWT bootstrap sequence: once your onModuleLoad has been called, the choice of the permutation (which includes the locale) has already been made. You have to alter the bootstrap sequence so it chooses the proper permutation for the user. ?locale=XXX does this (because the locale property has a that reads the locale query-string parameter, among other things), as well as the above.

    See also https://code.google.com/p/google-web-toolkit-incubator/wiki/ServerSideLocaleSelection for some idea (BEWARE: deprecated project!)

    Finally, there are a few issues with your *.gwt.xml, starting with kh not being a valid locale.

    The workflow for internationalizing your app is as follows:

    1. list your locales:

      
      
      
    2. remove the default locale by setting the locale property to the full list of supported locales:

      
      
    3. set the fallback locale:

      
      

    Optionally, you can select how the locale is determined using the properties locale.queryparam, locale.cookie, locale.usemeta, locale.useragent, and locale.searchorder (see the I18N.gwt.xml for their default and accepted values).

    And finally, add code to select the locale (e.g. the dynamic above)

提交回复
热议问题