Closed (won't fix)
Project:
Internationalization
Version:
7.x-1.4
Component:
Documentation
Priority:
Minor
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
24 Feb 2007 at 20:55 UTC
Updated:
11 Apr 2012 at 12:31 UTC
I am trying to show the language swithcer dynamically function -just as on the block but instead on switcher block on the header - page.tpl.php
and i tried with snippets below, but both cases it does not work any idea how it should be how it make work
(as alternative choosing the switcher block to show on the header area does not look right -breaks the theme look, so a snippet into the page.tpl.php should do the job just right)
thank you in advance
<?php
function phptemplate_i18n_link($text, $target, $lang, $query= NULL, $fragment = NULL){
$output = '<span class="i18n-link">';
$attributes = ($lang == i18n_get_lang()) ? array('class' => 'active') : NULL;
$output .= l(theme('i18n_language_icon', $lang), $target, $attributes, $query, $fragment, FALSE, TRUE);
$output .= " ";
$output .= l($text, $target, $attributes, $query, $fragment, FALSE, TRUE);
$output .= '</span>';
return $output;
}
?>
and
<?php
function phptemplate_i18n_link($text, $target, $lang, $separator=' '){
$output = '<span class="i18n-link">';
$attributes = ($lang == i18n_get_lang()) ? array('class' => 'active') : NULL;
// $output .= l(theme('i18n_language_icon', $lang), $target, $attributes, NULL, NULL, FALSE, TRUE);
// $output .= $separator;
// $output .= l($text, $target, $attributes, NULL, NULL, FALSE, TRUE);
$output .= l(t($text), $target, $attributes, NULL, NULL, FALSE, TRUE);
$output .= '</span>';
return $output;
}
?>
Comments
Comment #1
mohammed76hi.
this does work on my own website, so it's tested.
thanks
Mohammed al-shar'
Nattiq Technologies
Comment #2
ica commentedthat worked swiftly Mohammed, nice one
thank you!
Comment #3
jose reyero commentedThere are some snippets in the handbook.
Comment #4
robertoguzman commentedhow i can just hide the link for the current language?
how do i do if i have 4 enable language and i want to show up the translation for 2 language only?
Comment #5
adanbouzoua commentedHi Mohamed
I am testing D7, your code is not working.
How to make this works for Drupal 7 ?
Thanks
Comment #6
calbasiHi Jose,
Where are the handbook snippets? I've looked for them but I can't find them.
Regards.
Comment #7
jose reyero commentedIf they're not there, it is just they're not update for Drupal 7