views:

274

answers:

1

Drupal's $front_page variable contains the front page url for the current language. I am looking for a general way to receive this url for other another enabled language.

I would like to work in all cases - in any of the language negotiations alternatives, and also if the frontpage was defined to point to some other node.

I didn't find documentation to anything available in the core or in the i18n module. Did I miss anything?

+2  A: 

You just use the '<front>' for the url and the language option so this will print all of the front pages urls on a site.

$languages = language_list();
foreach ($languages as $langcode => $language) {
    print url('<front>', array('language' => $language)); 
}

if you need to make a link, you would use the l() function instead. What you pass to the url/l function is a language object.

googletorp

related questions