0

I have a multilingual Drupal site in english & french. At the bottom of every page is the content translation link, however I want to place this in a custom location on page.tpl.php. So if I hide the content translation links in the configuration, how do I call it via a function on the page template?

0

This worked for me. Incase there was no translation node, I send the user to the homepage.

$tpath = translation_path_get_translations($_GET['q']);
if ($language->language == 'en') {
    if (array_key_exists('fr', $tpath)) {
        $tlink = "<a href='/fr/" . drupal_lookup_path('alias', $tpath['fr'], 'fr') . "'>Français</a>";
    } else {
        $tlink = "<a href='/fr/'>Français</a>";
    }
} else {
    if (array_key_exists('en', $tpath)) {
        $tlink = "<a href='/" . drupal_lookup_path('alias', $tpath['en'], 'en') . "'>English</a>";
    } else {
        $tlink = "<a href='/'>English</a>";
    }
}

print $tlink;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.