eZ Community » Blogs » HUCK Florent » Language Switcher using bootstrap3

By

HUCK Florent

Language Switcher using bootstrap3

Tuesday 16 September 2014 11:30:36 am

  • Currently 3 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Small tutorial on how to create a language switcher based on bootstrap 3 and using eZ Community projects >= 2014.05 or latest enterprise 5.3

Hi,

This is how to use language switcher feature, using bootstrap 3, like it was done in legacy templates.

First, update your eZ Publish community project to 2014.05 (or older) or to 5.3EE

Steps:

  • In page_head_style.html.twig, add bootstrap 3 in the list of your loaded CSS files :
  • Configure your ezpublish.yml to declare siteaccess switcher group (translation_siteaccesses)
  • In your page_header.html.twig, call your subrequest to render the language switcher : 
  • Create your controller/action (Controller/LanguageSwitcherController.php) to render it (don't forget to change namespace if needed):
  • Create your template in Resources/Language/switcher.html.twig

Et voilà!

You can find more info on how to configure your ezpublish.yml here to get more advanced behaviors.

Cheers.

Proudly Developed with from