Actress Posted August 22, 2006 Share Posted August 22, 2006 Hi all!I'm a newbie on PHP and the small things I know I'm learning from tutorials, like sending forms by mail and stuff.But now I'm trying to figure out how to make a multi-language site without having to duplicate the site, only write the text in diferent languages and then load the text only acording to the language chosen. (don't need to change the images)Can it be done in PHP? Can you give me the url to any simple tutorial on how to do that?I only found strange "tutorials" that confuse me even more...Can you help me getting it on? I would be very apreciated! Link to comment Share on other sites More sharing options...
aspnetguy Posted August 22, 2006 Share Posted August 22, 2006 yes you will need multiple database fields to index and hold the differnt content in differnt languages.you will also need a variable to hold the current language being viewed in orde to know which lanaguage to pull from the database. Link to comment Share on other sites More sharing options...
justsomeguy Posted August 22, 2006 Share Posted August 22, 2006 You can also do it with files instead of a database. You can set up a file like this: <?php$page_title['en'] = "English title";$page_content['en'] = <<<END_OF_CONTENTEnglish page contentEnglish page contentEnglish page contentEnglish page contentEND_OF_CONTENT;$page_title['es'] = "Spanish title";$page_content['es'] = <<<END_OF_CONTENTSpanish page contentSpanish page contentSpanish page contentSpanish page contentEND_OF_CONTENT;?> You can keep track of the language in the session. Do a search on how to use sessions. But you can include your language file like this: <?phpinclude("page_content.php");echo "Page title is " . $page_title[$_SESSION['lang']];?> Link to comment Share on other sites More sharing options...
Actress Posted August 23, 2006 Author Share Posted August 23, 2006 Thanks to both! You've been very helpful! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now