I am willing to create a custom language switcher that will print out only the language which is not currently active. I don’t know how to link to the front page of a specific language or to translation of the current content/path.
Below is my code with the problem I’m facing:
global $language;
$lang=$language->language;
$variables['languagelink']='';
if($lang=="en") {
$variables['languagelink']=l(t("Arabic"),'HERE I DONT KNOW HOW TO LINK TO ARABIC FRONT PAGE OR THE TRANSLATION OF THE CURRENT CONTENT');
} elseif($lang=="ar") {
$variables['languagelink']=l(t("English"),'HERE I DONT KNOW HOW TO LINK TO ENGLISH FRONT PAGE OR THE TRANSLATION OF THE CURRENT CONTENT');
}
best way to do that is to hide the current language link with CSS. Usually the body has a specific class like
language-enori18n-enetc. using that, build your appropriate css selector to hide the current language link