Can i use attribute to choose stack language

Permalink
Looking throught the documentation, I'm wondering if it is possible to use page attributes to display a stack depending on the language chosen. Would that be the way to do go ? What would be the code to achieve this ? MAny thanks

 
adajad replied on at Permalink Best Answer Reply
adajad
Sounds similar like a problem I had with a static menu beneath a particular page and the internationalization add-on.

I don't think you need to use page attributes at all, but just look on the language in use and serve the appropriate stack.

<?php
$lh = Loader::helper('section', 'multilingual');
$lang = $lh->getLanguage();
if ($lang == "sv_SE"){
    $stack = Stack::getByName('svenska');
    $stack->display();
} else {
    $stack = Stack::getByName('english');
    $stack->display();
}               
?>


The above is based on you using the internationalization add-on. In the example I'm using Swedish and English, with English as fallback if current language isn't Swedish.

If current language is Swedish, then display the stack named 'svenska'. If not Swedish language, display the stack named 'english'.
ptityop replied on at Permalink Reply
Thanks so much , you just saved me hours of useless work I was about to do !!