Forums / Setup & design / Language links within menu?

Language links within menu?

Author Message

Olaf Fichtner

Sunday 04 July 2010 9:15:48 pm

Hello,

I wonder if anyone ever tried to embed language links into for example the top menu. I am sure there must be a method to create a manual link to switch to a language, a link that can be inserted into a menu - but I have not discovered any...

Yannick Komotir

Monday 05 July 2010 8:19:50 am

Hello,

are you try to do this with the switchlanguage module ?

<|- Software Engineer @ eZ Publish developpers -|>
@ http://twitter.com/yannixk

Olaf Fichtner

Monday 05 July 2010 9:19:13 am

I think so... Sorry, I only started recently, with 4.3, so I am not sure how this was done in previous versions. I just searched and it seems that there is a built-in module called "switchlanguage" in 4.3. (heard of it the first time), so the answer should probably be "yes".

Olaf Fichtner

Tuesday 06 July 2010 12:12:57 am

I think I made a little bit progress: I put the content of extension/ezwebin/design/ezwebin/templates/page_header_languages.tpl into extension/ezwebin/design/ezwebin/templates/menu/double_top.tpl, right before the /ul for topmenu-firstlevel.

Language links are correctly showing up in the topmenu now, but they are lining up with all other menu items on the left. Now I try to find a way to get them aligned to the right, while regular menu items should be on the left...

Btw, if I want to use an override for double_top.tpl, where should I put that? I tried extension/ezwebin/design/ezwebin/override/templates, but there was no change...

Olaf Fichtner

Wednesday 14 July 2010 6:51:10 am

OK, solved. I am sure there may be a more elegant way to do this, but I got it working this way:

As I said, I copied the code from the languages template into the double top menu template, between the closing ul for the first line and the closing div. I put the code into a ul with the id "topmenu-language".

Next I copied all CSS settings regarding "topmenu-firstlevel" into my override CSS, renaming "firstlevel" to "language" and added a "float:right" to "div#topmenu ul#topmenu-language li", because I wanted the regular menu items on the left, while language links should be on the right. In the same section I changed the separator image setting from left bottom to right bottom and copied the separator and selected link background image to the override image folder.

To highlight the selected language, I changed "li.selected" in these sections to "li.current_siteaccess". Unfortunately the language code does not know "firstli" to designate the first link (though that probably could be done), so there is a separator line on the right edge, but I can live with that.

Maybe this helps someone to break the "typical ezP layout" that sometimes gets mentioned here on the forums. And if someone has a better solution, don't be shy...