1
votes

i am building a website with a multi-language feature.

it would be hard if each of the pages are to be created manually for each language so instead, i have different php files for each language containing define() statements like

<?php
    define("hello", HELLO);
    define ("there", THERE);
?>

and the webpages will only contain constants in between the HTML tags like

    <h1><?php echo HELLO; ?></h1>
    <h2><?php echo THERE; ?></h2>

and depending on the language choice of the user, the language php file (en.php, fr.php..) will be included in the page.

by default, the en.php (english text) will be the included file.

i'm not sure about this but will search engines still be able to index the page? like it would see the english text and not just the constants?

also, is there a way so that the other translations will also be indexed?

thanks!

2

2 Answers

4
votes

The search engines are crawling your website like a normal user, they won't be able to see the constants. Those defines are on server side and cannot be access by search engines.

Also I advise you to take a look Zend_Translate, I think it would be a bit more flexible then building define.

3
votes

Search engines see what the users see (as long as you're not putting texts in images or something like that). To ensure that the whole site gets indexed, including all the different language versions, create a sitemap.