I make a web page with dynamically changing language with php. I make html with $lang
key
<span class="slicice_opis">
<?= $lang['LIJEVO_PRVI_OPIS_PARAGRAF_JEDAN']; ?>
<?= $lang['LIJEVO_PRVI_OPIS_PARAGRAF_DVA']; ?>
<?= $lang['LIJEVO_PRVI_OPIS_PARAGRAF_TRI']; ?>
</span>
and I call translate from php file depending on clicked language in dropdown on web page
<?php
/* eng.php */
$lang = array(
'LIJEVO_PRVI_OPIS_PARAGRAF_JEDAN' => 'Test Test',
'LIJEVO_PRVI_OPIS_PARAGRAF_DVA' => 'Test Test',
'LIJEVO_PRVI_OPIS_PARAGRAF_TRI' => 'Test Test',
);
?>
<?php
/* it.php */
$lang = array(
'LIJEVO_PRVI_OPIS_PARAGRAF_JEDAN' => 'Test Test',
'LIJEVO_PRVI_OPIS_PARAGRAF_DVA' => 'Test Test',
'LIJEVO_PRVI_OPIS_PARAGRAF_TRI' => 'Test Test',
);
?>
This is dropdown where I click on wanted language and pass parameters to URL And when I change language my url look like this testtest.com?lang=en
or testtest.com?lang=fr
etc.
<ul>
<li><a href="?lang=en">en</a></li>
<li><a href="?lang=fr">fr</a></li>
<li><a href="?lang=es">es</a></li>
<li><a href="?lang=it">it</a></li>
</ul>
This is working very well, but I need a suggestion for WEB page optimization for SEO in this way, with this way of translate. I dynamically also change and meta keywords and description, <html lang="selectedLang">
, and title and alt on img depending on the selected language.
Default language is ENGLISH, and when Google index my page it's in English. How to make and set links for indexing in another language? My dropdown with language for select is in the footer, is this ok or I need to make another link in the header? I don't understand how SEO works in this way of translate web page. Thank you very much