php - Internationalisation language switch?

461

I am using the internationalisation block for basic page translation between Spanish and English. By default the content is in Spanish. When I change the language to English the page content is translated, however the autonav appears blank. I have used page CID's to determine the language differences. In my header.php file for my theme I am using the follow statement:

if(!$c->getAttribute('english_menus')) {
$lh = Loader::helper('section', 'multilingual');
$lang = $lh->getLanguage();
$bt = BlockType::getByHandle('autonav');
$bt->controller->displayPages = 'custom';
if ($lang == "en_EN"){
  $bt->controller->displayPagesCID = 166; //English section cID
} else {
  $bt->controller->displayPagesCID = 171; //Spanish section cID
}
$bt->controller->orderBy = 'display_asc';
$bt->render('templates/top_nav/view');
}

This displays the top level navigation fine. however when the country flag is selected the auto nav menu disappears and does not display in english

Many Thanks

178

Answer

Solution:

Do you mean to have the

if (! $c->getAttribute('english_menus')) {

at the top?

It doesn't make much sense to me. Any chance your english page (or whatever page you land on after the country flag) has that attribute set to something?

People are also looking for solutions to the problem: php - Laravel Eager loading with nested OR condition

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.