I'm trying to create simple language switcher for my site on Fat Free Framework. My logic is next:
The main issue for me – how to get that previous page route name? I'll be appreciated for any help.
You need to track the previous page URL somehow. Here are 2 ways to do it:
/lang/@lang?uri={{ urlencode(@URI) }}
$_SERVER['HTTP_REFERER']
. Since this value is not 100 % reliable and may even not be set at all, you should make a quick check of its relevancy (same domain?) before using it, and fallback on the homepage otherwise.