I need to create multilingual site with Concrete5 (v 5.7).
I've a custom theme and my page layout would be:
Home
|-en
|--Frontpage
|--Contatcs
|-<language2>
|--<Frontpage>
|--<Contacts>
With current navigation implementation:
<nav class="nav">
<?php
$bt_main = BlockType::getByHandle('autonav');
$bt_main->controller->displayPages = 'top';
$bt_main->controller->orderBy = 'display_asc';
$bt_main->controller->displaySubPages = 'none';
$bt_main->render('templates/level1');
?>
</nav>
I get the result where in the navigation there is only | EN | <language2>
|
Can't find any proper document how to fix or use multilingual settings.
With Concrete5 version 5.7.x.x you can use Global areas. Global areas can be setup differently for each language.
When using a global area, you can add an autonav block on one language and show pages below and in the other language you can add an autonav block which shows pages below .
Another advantage of working with a global area is the templates. Hardcoded blocks are known to always show the default template (view.php, view.css).
If you do not want anyone else (except the superuser) to be able to edit the global area, you can use this code:
$u = new User();
$areaNav = new GlobalArea('Navigation');
if(!$u->isSuperUser()){
$areaNav->disableControls();
}
$areaNav->display($c);
If you really want to work with a hardcoded block, you can still check for the language and load a different (hardcoded) block for each language.
$lang = Localization::activeLanguage();
if($lang == 'en'){
//hardcoded block for english language
}else if($lang == 'fr'){
//hardcoded block for french language
}