Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to keep the home page i18n on subsequent failed log in attempts
    text
    copied!<p>When a user first clicks a link to my homepage, if the link contains ?langId=fr_FR the page displays in French; so far so good. If the user makes a failed attempt to log in the page will display the error message in French, which is perfect. The problem is if a second failed attempt is made to log in. In this case the page language defaults to English.</p> <p>I am not sure how to keep the page in French for the above case (i.e. any subsequent requests when the initial url contained langId=fr_FR). Should I be using a CookieLocaleResolver instead of a SessionLocaleResolver?</p> <p>The site uses Spring Security and I have implemented a filter which runs before the Spring Security filters. This filter will set the LocaleContextHolder using the langId request parameter. This works great for the initial log in attempt. Any other requests made and I loose the langId parameter.</p> <p>Is there something I can do in the loadByUserName() method that will allow me to persist the original langId? </p> <p>Here is the config for the resolver and interceptor</p> <pre><code>&lt;bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver" &gt; &lt;property name="defaultLocale" value="en" /&gt; &lt;/bean&gt; &lt;mvc:interceptors&gt; &lt;bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"&gt; &lt;property name="paramName" value="langId" /&gt; &lt;/bean&gt; &lt;/mvc:interceptors&gt; </code></pre> <p><strong>EDIT</strong></p> <p>Using a CookieLocaleResolver instead of a SessionLocaleResolver does fix this issue. But, if users disable cookies then I am back to square one. I'd like to find a way to keep the page in French upon multiple log in attempts for a user. Any help is really appreciated Thank you!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload