0

I am coding multi-languages web site with Drupal 7. Does anyone know how can I customize the language links like adding lang. flag, changing color of links and so on?

thank you .

1 Answers1

0

To set the language to a link, use the language property inside the l() function's array $options.

Note that, the language property does not take language code, instead it takes language object. To get the language object for any enabled languages, you can use the code below.

function _return_language_object($langCode)
{ // better to place this code inside your theme's template.php file.
    $languages = language_list(); // see http://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/language_list/7
    return $languages[$langCode];
}

Then use the l function to print the link.

print l("English Homepage", "", array(
     'language' => _return_language_object("en"),
));
Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105