| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| New Member Join Date: Feb 2004
Posts: 2
![]() | languages Hi it is maybe a noob question but I've never done this before. I need to build a site in 4 different languages. I want them to choose on the mainpage to choose which language they prefer and than they can continue in that language. Can anyone help me with the most effecient way please? thx for your time |
| |
| | #3 (permalink) |
| Senior Member Join Date: Aug 2002
Posts: 1,255
![]() ![]() | I think I would just build the first site with one language, then take and transform that site to use the next language etc.. Then possibly just have each site in it's own directory and on the main page have a little drop down to select your preferred language which would take you to the correct index page for the language selected. |
| |
| | #6 (permalink) |
| Senior Member Join Date: Aug 2002
Posts: 1,255
![]() ![]() | Oh sorry, I thought you meant four different programming languages, lol dunno what I was thinking. But I think I would still do it the same way with building the four separate sites with different languages and having each language in separarte directories. Then you could even auto detect the visitors browsers default language and redirect them to the appropriate file. What you're wanting to do with four separate languages and one set of files I think would require you to make a language file with variables for each word you're going to be using on your website. lang[web design]=Web Design lang[web design]=El Diseño de la telaraña ????: NamePros.com http://www.namepros.com/programming/21250-languages.html That's just an example, but you'd need one for each word in each language. It may be best to make these in four separate files, one for each language. Then you would have to set cookies or something like that when they select their language so it can remember which words to use. So you'd have to have something like if language = french then include your french language file else if language = spanish then include your spanish language file and in your code each word would need to be printed as a variable such as lang[web design] which would print the correct word based on the file you included. |
| |
| | #7 (permalink) |
| NamePros Member Join Date: Dec 2003 Location: GB, WI
Posts: 69
![]() | most effecient way would be to do it in flash, with ASP, PHP and all the other stuff you still have to send a request back to the server and all that stuff. with flash you can just send it all at once so theres no re-load time thats the most effecient way but, its kinda hard to do.
__________________ Bryan Louis -Xeplin Development- http://www.xeplindevelopment.com -Personal- http://www.bryanlouis.net |
| |
| | #8 (permalink) |
| RyanPrice.ca - Developer Join Date: Dec 2003
Posts: 1,328
![]() ![]() ![]() | You could keep a mySQL database with each page stored 4 times as a different column. For example: File Name - index.html English - <code for english> French - <code for french> Spanish - <code for spanish> Then when the user selects their language you can send a cookie or start a session on the server with that data saved. All it is from there is a simple if statement on each page.
__________________ Ryan Price - Webmaster www.HostDurham.com - For Hosting | www.jeanco.ca - For Webdesign |
| |
| | #9 (permalink) |
| Account Closed Join Date: Feb 2004 Location: Bothell, Wa
Posts: 237
![]() | what i think would work the best is this. if (IE){ document.write("<LINK REL=STYLESHEET HREF=\"/lwsd/css/ie_style.css\" TYPE=\"text/css\">"); }else if (Mac){ document.write("<LINK REL=STYLESHEET HREF=\"/lwsd/css/mac_style.css\" TYPE=\"text/css\">"); }else if (NS){ document.write("<LINK REL=STYLESHEET HREF=\"/lwsd/css/ns_style.css\" TYPE=\"text/css\">"); ????: NamePros.com http://www.namepros.com/showthread.php?t=21250 }else{ document.write("<LINK REL=STYLESHEET HREF=\"/lwsd/css/ns_style.css\" TYPE=\"text/css\">"); That's a php script in the head section from my districts site. I'm thinking you can do that like this if (spanish){ include 'spanish.php' } Not very good with php, so wouldn't know if that's right. |
| |