1

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

1

If you're going to use the "?" parameter on your site, you should probably notify Google as to how to react to these parameters. You can tell Google how to treat your parameters at https://www.google.com/webmasters/tools/crawl-url-parameters?hl=en&siteUrl=

Make sure you are using the hreflang="x" tag if you want to signal to Google what language your page is in. Learn more here: https://support.google.com/webmasters/answer/189077?hl=en

If you want to simplify the process and not have to inform Google about your "?" parameter pages, you can simply change the URL of the page altogether. Google will index both example.com/page/en and example.com/page/es

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.