Question

I call a function "foo.action?request_locale=en" on my form. There is an xwork-validation on that page and I expect to get an validation error in the given language. What I get is a page in Finnish - my browser default language - and I expected one in English.

How it is possible to change the used language on a jsp page (that's where the request_locale comes from) so that the called action from my form will show up with that selected language and not the browser default one?

Some specs: struts.xml has a line because my actions are at fi.foo.action directory and i18n resources at fi/foo/package_en.properties and such files.

Validators are at barAction-foo-validation.xml kind of files at fi.foo.action folder.

fi = Finnish

My application works otherwise fine but this language setting is giving wrong language on screen.

Was it helpful?

Solution

It sounds like the i18n interceptor is not configured for your action's interceptor stack. The i18n interceptor is defined fourth in the defaultStack. Make sure you are not overriding the stack for your action. If it appears to be configured, then try setting a breakpoint in the intercept method of the I18nInterceptor to confirm that it is being invoked. Otherwise, what you have should work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top