Jump to content

If translation does not exist, link to default language?

Lance O.

Recommended Posts

This issue may have been answered earlier, but I'd like a little clarification if possible.

The site I am developing has one section that is translated into French Canadian. Only the pages in this section are translated. The site's Home page is only in English, which is the default language. The English name setting on the Home page is blank, and the French name setting is "fr".

All of the pages in the translated section have the Active? checkbox next to the French name on the Settings tab checked. No other pages have this option checked, including the Home page.

URL examples:

When viewing the http://domain.com/fr/drainage-pipe-products/ page, links included in the page's navigation automatically include the /fr/ in the url, even though those pages don't explicitly have the Active? checkbox selected. That's not the behavior I was expecting.

Is this normal behavior? If this is normal behavior, then what is the purpose of the Active? checkbox? Have I configured something incorrectly? Any insight is appreciated. I feel like there is something I'm missing.

Link to comment
Share on other sites

The url exists even if the language isn't active, but it will return a 404 in this case.

You have 2 options to solve your problem:

  1. modify your code of your navigation, check the language specific status of the page you want to add to the nav.
  2. via template. disable multilanguage support under advanced tab in your single language templates.

Code for 1. option:

$nav = '<ul>';
foreach ($pages->find('parent=1,include=all,status<1024') as $p) {
    $url = ($user->language->isDefault() == false && $p->{"status{$user->language->id}"} == 0)? $p->localUrl($languages->getDefault()):$p->url;
    $nav .= "<li><a href='$url'>$p->title</a></li>";    
$nav .= '</ul>';


  • Like 3
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...