Multilingual. Links like /<lang>/<presenter>/<action>/{action method args devided by slash}

- zalizko
 - Member | 7
 
usualliy I write the code after after understanding how it works.
, but with Nette it's not easy, because clean documentation is not
enought..
I tried at random, working or not )) and it works:
app\router\RouterFactory.php:
<?php
class RouterFactory {
    /**
     * @return \Nette\Application\IRouter
     */
    public function createRouter() {
	$router = new RouteList();
	$router[] = new Route('<lang>/<presenter>/<action>[/<id>]', array('lang' => 'en', 'presenter' => 'Homepage', 'action' => 'default'));
	return $router;
    }
}
?>
app\templates\@layout.latte:
<?php
// ...
<body>
	{foreach $flashes as $flash}
	    <div class="flash {$flash->type}">{$flash->message}</div>
	{/foreach}
        {include content}
        <div id="footer">
            <a n:href="homepage:default">Home</a>
            <div id="languages">
                <div>Languages:</div>
                <ul>
                    <li n:foreach="$languages as $language">
			<a n:href="default lang => $language">{$language}</a>
		    </li>
                </ul>
            </div>
        </div>
    </body>
// ...
?>
now need to understand how to do a link on current presenter and current action. link on current presenter possible to do by omitting presenter in template <presenter>:<action>, but how to pass current action …

- echo
 - Member | 134
 
zalizko wrote:
‘magic’ word this halps!
however, WHERE IT'S IN DOCUMENTATION?!?!?!??!
topic closed.
It is mentioned in the text here (“Special case is linking to itself, when
we'll write this as the target.”):
https://doc.nette.org/…n/presenters#…
… but it is easy to overlook and should be highlighted