symfony - Symfony2 language switcher bundle default inclusion in base template -
i'm searching solution how can implement bundle base-template visible on every page of project without including every single template/bundle.
is possible? it's language switch , thought building bundle it, can interact directly set locale links etc...
edit: maybe need set service??
my problem is; how language selector base template without route ?
so @ least figured out how handle this. maybe not beauty, working can checkout better solution
public function localize_route($locale = null) { // merge query parameters , route attributes $attributes = array_merge($this->request->query->all(), $this->request->attributes->get('_route_params')); // set/override locale $attributes['_locale'] = $locale ?: \locale::getdefault(); return $this->router->generate($this->request->attributes->get('_route'), $attributes); }
as it's described here http://blog.viison.com/post/15619033835/symfony2-twig-extension-switch-locale-current-route
so works
Comments
Post a Comment