I am going to implement the bilingual website in PHP. The website default language is Arabic and another language is English. I have completed my website in both languages. But both languages websites working separately.
I want to make so that the user can open the website in arabic by default, but can change it to English by clicking on the switcher button.
After clicking this button the user will be redirected to the English version of the page.
Here are the arabic and english versions.
<ul class="nav navbar-nav">
<li><a href="home?lang=<?php echo $lang;?>">الرئيسية </a></li>
<li><a href="quote?lang=<?php echo $lang;?>">طلب عرض أسعار</a></li>
<li><a href="contactus?lang=<?php echo $lang;?>">اتصل بنا</a></li>
<li><a href="price_index?lang=<?php echo $lang;?>">مؤشر الأسعار</a></li>
<li><a href="<?php echo SURL.'en';?>?lang=en">English</a></li>
</ul>
**language page PHP script code**
enter code here
if(isSet($_GET['lang']))
{
$_SESSION['lang'] = $_GET['lang'];
// register the session and set the cookie
$lang=$_SESSION['lang'];
}
else if(isSet($_SESSION['lang']))
{
$lang = $_SESSION['lang'];
}
else
{
$lang = 'ar';
}