How to use the Internationalization plugin?

Permalink
Hello there! I want to use the Internationalization plugin, but I don't really understand some things. I set up the sitemap as seen in the screencast, I associate some languages to the appropriate nodes through the dashboard, but I now face several issues:
1) When I visit the site, the autonav block which should be a main navigation panel, now displays the four languages, instead of a 'main menu' for some default language. How can I select a specific node to be the default page?
2) My custom theme has several hardcoded autonav blocks at certain areas. Is there a way to ensure these menus to be generated using the appropriate subtree?

The aforementioned autonav in 1) is also hardcoded in the theme. Thank you for any advice!

 
szucslaszlo replied on at Permalink Reply
Okay, however embarrasing it is, I realized, that there is actually a setting I overlooked, for setting up a default language and redirecting there. I still need some help in the second question though!
szucslaszlo replied on at Permalink Best Answer Reply
Well, I've managed to find a solution on my own. In case anyone else was wondering, here it is: I traverse all the ancerstor pages up to the root of the actual site tree, starting with the actual page - this is important. Then, I would get the next to last page, get the path for that page (which is actually a language section) and give the autonav blocks the appropriate collection id, based upon the required path, concatenated to the aforementioned path of the language section. Ofcourse this would not help anyone, who is new to building highly customized C5 sites, so I shall write down all this a little more specifically. Here we go:

First, we need to call in the navigation helper:
$nh = Loader::helper("navigation");


Now, we shall do the traversing, or rather, make C5 do it for us:
$arr = array();
// the line below, shall return an array of Page objects with all the ancestor pages
$arr = NavigationHelper::getTrailToCollection(Page::getCurrentPage());
// we need to put the current Page object at the front of our array - this way, we can easily get the correct Page object (which is an actual Language Section) even if we are at the root of one of the subtrees, representing one of the languages
array_unshift($arr, Page::getCurrentPage() );
// thanks to our genius foreseeing, we can rest assured, that the root of the current language section is stored at the index below.
$languagePageObject = $arr[ count($arr)-2 ];


Now when we generate our main navigation later on the page, we can generate the navigation starting from the correct node, like this:

$bt = BlockType::getByHandle("autonav");
$bt->controller->orderBy = "display_asc";
$bt->controller->displayPages = "custom";
$bt->controller->displayPagesCID = $languagePageObject->getCollectionID();
$bt->controller->displaySubPages = "none";
$bt->controller->displaySubPageLevels = "none";
$bt->render("templates/plusparent");


That's all there is to it! The situation can get a bit more complicated, if we have more specifically generated navigations, based upon, for example a site structure. What if we have /english/product-info/c-2000 and /deutsch/produkten-info/c-2000 ? Well, all we have to is add an altenative path/alias to the appropriate german pages, and our automatically generated navigations shall find their way through our multilanguage jungle. :) Have fun!