User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,510 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,681 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 2341 | Replies: 10 | Solved
Reply
Join Date: Aug 2007
Posts: 14
Reputation: Tony Barber is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Tony Barber Tony Barber is offline Offline
Newbie Poster

Question Multi Language web page

  #1  
Sep 29th, 2007
I want to construct a web page with language flags. The user clicks his flag and the web page is then displayed in his language. In VB6 I would achieve this with a resource file. Does HTML, PHP or CSS have something like that or must I create a web site for each language.
I would very much appreciate any advice on this. The Languages would be English, German, Dutch and Danish
Many thanks
Tony
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 643
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 72
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Practically a Master Poster

Re: Multi Language web page

  #2  
Sep 29th, 2007
i would use a mysql database and php to do it. have mysql store the different lanuages and display them based on the url ex. website.com/index.php?lang=en where en would be english and so on. the php script will do the rest. there are various ways of doing this but i have not tried the others.
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 643
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 72
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Practically a Master Poster

Re: Multi Language web page

  #3  
Sep 29th, 2007
just thought of a different way. what you could do is have a language directory. in that directory you have folders with the language name on it. ex (English, Spanish, ect.). in these directories you have the same files (header.html,footer.html,mainbody.html, ect.) and all you have to do is change the language of the text in each file that corresponds to the folder. if the file names are different in each folder it will not work. then php will read the url and change the include directory in the page using a session.

this might be a bit confusing. if it is i will go into more detail, maybe even some code. all you have to is let me know.
Last edited by kkeith29 : Sep 29th, 2007 at 5:04 pm.
Reply With Quote  
Join Date: Aug 2007
Posts: 14
Reputation: Tony Barber is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Tony Barber Tony Barber is offline Offline
Newbie Poster

Re: Multi Language web page

  #4  
Sep 29th, 2007
Would have got back to you quicker but I had to re-boot.
It is a bit confusing, it would be great if you could show how to do it with a bit of code. I am new to Web pages and am just learning PHP and CSS
Many thanks
Tony
Reply With Quote  
Join Date: Aug 2007
Posts: 14
Reputation: Tony Barber is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Tony Barber Tony Barber is offline Offline
Newbie Poster

Re: Multi Language web page

  #5  
Sep 29th, 2007
I think I might have sent my reply as a general reply and not to you personally. So I have tried again
Would have got back to you quicker but I had to re-boot.
It is a bit confusing, it would be great if you could show how to do it with a bit of code. I am new to Web pages and am just learning PHP and CSS
Many thanks
Tony
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 643
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 72
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Practically a Master Poster

Re: Multi Language web page

  #6  
Sep 29th, 2007
to make it easier for both of us, please post your html code. I will make the necessary changes and then explain it all to you so you get it.
Reply With Quote  
Join Date: Aug 2007
Posts: 14
Reputation: Tony Barber is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Tony Barber Tony Barber is offline Offline
Newbie Poster

Re: Multi Language web page

  #7  
Sep 29th, 2007
I don't have any HTML code as yet. I had not started because of the language question. I didn't want to put a lot of work into the pages only to find out I had to start again. But I will do a simple front page but that might take a couple of days if that is ok with you.
Sorry, but another silly question -How to I post you the HTML?
Regards
Tony
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 643
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 72
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Practically a Master Poster

Re: Multi Language web page

  #8  
Sep 29th, 2007
when you have finished the code just copy and paste it into the message box when you reply. make sure you wrap it in tags though.

while you finish that page i will finsh the php code for you to use. it should be done by the end of today.
Last edited by kkeith29 : Sep 29th, 2007 at 6:19 pm.
Reply With Quote  
Join Date: Sep 2007
Location: Budapest
Posts: 252
Reputation: fatihpiristine has a little shameless behaviour in the past 
Rep Power: 0
Solved Threads: 14
fatihpiristine's Avatar
fatihpiristine fatihpiristine is offline Offline
Posting Whiz in Training

Re: Multi Language web page

  #9  
Sep 30th, 2007
it is quite simple..

index.php?lang=en

links to change lang.
?lang=hu
?lang=spa
?lang=deu

requesting,
$lang = $_request['lang'];
if ( $lang = "" || $lang = "en")
{
header('Location: /en/');
}
if ( $lang = "hu" );
{
header('Location: /hu/');
}

and so on....

if u wanna go further.. check explorer's default language.. that would be cool.
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 643
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 72
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Practically a Master Poster

Re: Multi Language web page

  #10  
Sep 30th, 2007
yes, that way would work but wouldn't you have to recreate the site four different times in different languages. i thought he was trying to avoid having to do that.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 3:50 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC