I am trying to add international website support based on Erlang Web 1.4.
I would like to have a couple of links on each page (the notorious country flags) that allow the user to set their language session variable.
Now I have a link like:
<li><a href="/session/language/en">English</a></li>
Where, in the session controller, I do:
language(Args) ->
LanguageId = proplists:get_value(id, Args),
case language_is_supported(LanguageId) of
false ->
ok;
true ->
wpart:fset("session:lang", LanguageId)
end,
{redirect, "/"}.
The problem is that after setting the preferred language, I would like the user to be redirected to the page he was visiting before changing the language. In this case, the variable "__path" does not help, because it contains a language request, not the "previous" one.
How can I solve this situation? I may be using the wrong approach, but now I can do nothing.