In my application(GWT(EXT_GWT) + Spring) I need to set user(after login) his native language, without get params. For example: user filling his login&pass at login form and then redirecting at ready-to-work form (this form must be with native user language. Locale I get from db). My language files written at .properties files and enumerated in module.gwt.xml config.
So question is – how I can set language? Maybe with session or post params? But I don’t understand how GWT before loading page choose needed locale. Some methods to set locale at gwt before page loaded?
Thanks!
Using the built-in internationalization and using it as intended, you can’t do this without reloading the page. The built-in i18n relies on only loading the compiled permutation that corresponds to the selected locale. This means you can’t just add a meta tag, you can’t just flip a setting, and you won’t be able to read from the built in LocalInfo class.
Two options, as I see it. First, make the reload less expensive, so you can use the i18n stuff GWT comes with. To do this, break out the rest of the app from the login, either by making a new app, or by using split points, so as little code as possible is loaded. Compiles files should be caches, so it shouldn’t affect the download time, just the time it takes to start the app.
Second option, following your constraint of not reloading: Don’t use the built in I18n, but find another way to pull in strings based on runtime data (as opposed to the usual compile-time approach).