I am new to this field. While in the browser it turns out to read the current localization and the list of possible:



 for (String s : LocaleInfo.getAvailableLocaleNames()) { ... } 

I would like to programmatically (for example, in a client-side dialog) set a locale, i.e. something like setLocaleName(s) ;

I searched, found nothing, apparently looking for the wrong place. Is this even possible?


As suggested by @krivenko tried through Window.open (...) , the locale has changed, but as suggested the application has restarted from the beginning.

The question of how to take ALL the contents of the address bar of the browser remained, I restarted hard by inserting the URL into the text of the program.

Actually, I need to control the behavior of the methods of classes that extend the gwt.i18n.client.Messages / Сonstants classes.

Perhaps it will be enough to be able to dynamically change <meta name = "gwt: property" content = "locale = x_Y">.

But I can not find how to get to it.

    1 answer 1

     String address = ...; String locale = LocaleInfo.getAvailableLocaleNames()[0]; Window.open("address?locale=" + locale, "_self", ""); 
    • Thank you so much ! But, as you know, for every correct advice you need another 10, how to execute it ... Actually the next question, and how to extract the String address? As far as I understand, this is the contents of the field for the browser URL. And one doubt, while the application will not restart from the beginning? So it turns out, if you add your hands? Locale = ru in the browser window. - avp
    • one
      Window.Location.getHref () - cy6erGn0m
    • @ cy6erGn0m Thank you! It turned out luggage is growing. And yet, how can I switch the locale without restarting the application? - avp
    • one
      Using cookies. - Nicolas Chabanovsky
    • one
      There is another repository from the set of HTML5, but it is intolerable. And you can also save on the server if the user logs in. This is often very useful. - cy6erGn0m