Claude Posted October 22, 2013 Posted October 22, 2013 I am building a small multi language page and everything is up and running smoothly!Except: the client would like to rearrange the languages showing in the language switcher. It is currently showing the default order from Setup > Languages and starts with the default language. Is there a way to move them around and have them in different order? Cheers Claude
interrobang Posted October 22, 2013 Posted October 22, 2013 You can sort the languages in the site tree (Admin/Setup/languages) 3
Claude Posted October 22, 2013 Author Posted October 22, 2013 I don't get it... I can't move anything on admin/setup/languages/, there is just the list with my languages to click on.
interrobang Posted October 22, 2013 Posted October 22, 2013 When you click on one of your languages in the site tree you don't get the usual "edit", "new", "move" menu? I am talking about moving the language pages in the site tree an the left side of the screen, not in the languages setup page you see when you go through the setup link in the top navigation. Btw, welcome to the forum! 1
adrian Posted October 22, 2013 Posted October 22, 2013 Are you in the page tree - see attached screenshot EDIT: What interrobang said 1
Claude Posted October 22, 2013 Author Posted October 22, 2013 Thanks guys! Not that hard to find if I think about it..... Cheers!
a_marffy Posted March 17, 2014 Posted March 17, 2014 Hi all! I have the exact same problem and try to reorder the languages. I also moved them around (yes, in the page tree), but the order on my client's site stays the same (default, français, deutsch). Is there something wrong with my code that generates the language picker? <?php // remember what language is set to $savedLanguage = $user->language; foreach($languages as $language) { // if this page isn't viewable (active) for the language, skip it if(!$page->viewable($language)) continue; // set the user's language, so that the $page->url and any other // fields we access from it will be reflective of the $language $user->language = $language; $activeClass = $savedLanguage == $user->language ? ' class="active"' : ''; // output a link to this page in the other language echo "<li><a$activeClass href='$page->url'>$language->title</a></li>"; } // restore the original language setting $user->language = $savedLanguage; ?> Thanks, tron1000
Soma Posted March 17, 2014 Posted March 17, 2014 $languages does not return languages in the order as they're in the tree. But you could get language yourself since language is a page with template "language"... and add a sort=sort. $allLangs = $pages->find("template=language, include=all, sort=sort"); 2
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now