flowRequestContext not available in error.vm
Dominique Petitpierre
Dominique.Petitpierre at unige.ch
Mon Jul 11 15:39:39 EDT 2016
Hi Christopher,
here is how we added locale choice in all the user views, including error.vm:
#if ($request.getQueryString())
#set ($querynolang = $request.getQueryString().replaceAll("&?lang=[a-zAZ_]+",""))
#else
#set ($querynolang = "")
#end
#set ($lang = $springMacroRequestContext.getLocale().getLanguage())
<div class="lang">
#if ($lang.matches(".*[Ff][Rr].*"))
FR | <a href="?$querynolang&lang=en">EN</a>
#else
<a href="?$querynolang&lang=fr">FR</a> | EN
#end
</div>
Not very general, but good enough for us.
$lang is initially set to the browser's locale preference (no default set in the localeResolver bean), then it is set to the flow's locale ("stateful" while the flow lasts).
cf. Shibboleth - Users post: IDPv3 internationalization via links and cookies
http://shibboleth.1660669.n2.nabble.com/IDPv3-internationalization-via-links-and-cookies-td7620273.html#d1446659314000-233
Let us know if you implement a different solution!
Regards,
Dominique Petitpierre
On 07/11/2016 05:23 PM, Christopher Greiner wrote:
> Hello shib users,
>
> I'm in the process of personalising our IdPv3 and wanting to add links
> on the various login/error pages enabling a user to switch locale.
>
> On the login.vm template, I use the following:
>
> <a href="$flowExecutionUrl&lang=en">EN</a>
> <a href="$flowExecutionUrl&lang=fr">FR</a>
>
> which works great after following the wiki article:
> https://wiki.shibboleth.net/confluence/display/IDP30/Switching+locale+on+the+login+page#Switchinglocaleontheloginpage-URLquerystringbasedlocalechanging
> (thanks Etienne!)
>
> On the error.vm template however, it simply outputs $flowExecutionUrl,
> not the actual flow execution url. Am I missing something or is this a
> bug? From the comments it seems like it should work.
>
--
Mr Dominique Petitpierre, user=Dominique.Petitpierre domain=unige.ch
IT Division, University of Geneva, Switzerland
More information about the users
mailing list