I want to make a site multilingual.
I have an normal interceptor stack which contains
<interceptor-ref name="i18n" />
A common jsp for changing locale:
<s:a action="locale-manager" namespace="/common">
<s:param name="request_locale">fa_IR</s:param>
فارسی
</s:a>
<s:a action="locale-manager" namespace="/common">
<s:param name="request_locale">en_US</s:param>
English
</s:a>
And a simple LocaleManager action
public class LocaleManager extends ActionSupport{
private static final Logger log = LoggerFactory.getLogger(LocaleManager.class);
public String execute() {
log.debug("Change the local to {}", getLocale() );
return "homepage";
}
}
In the above scenario the i18n interceptor always run for all actions, which is not got solution. Because the locale only change when user clicks on locale-manager action.
I tried to remove the interceptor stack and add i18n interceptor only to LocaleManager as below
@InterceptorRefs({ @InterceptorRef("i18n") })
public class LocaleManager extends ActionSupport{
.........
But it did not worked ?! Am I missing something, or should I write my own interceptor ?