Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 21st, 2007, 7:11 AM   #1
ktsirig
Programmer
 
Join Date: Oct 2005
Posts: 54
Rep Power: 4 ktsirig is on a distinguished road
multilanguage site

Hello all!

I want to construct a multi-language site. I have my data stored in a database and I wanted to know if there is a way of me knowing which language the user sees. Imagine having a little flag on top of the page and when tha users presses it, he/she will see the data in english or in german or in greek etc... How can I keep track of the language though? If, for example, tha user selects ENGLISH in index.html, and then browses through the entire site, how can I know in every page, that I must retrieve the english data from my database?

Thank you!
ktsirig is offline   Reply With Quote
Old Sep 21st, 2007, 11:25 PM   #2
King
Professional Programmer
 
King's Avatar
 
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 377
Rep Power: 0 King is an unknown quantity at this point
Well if you are storing all the language text in the database, this should be relatively easy. If the user selects English, you can set a session variable to English. Then on every page that person visits, in the page load you can check what language that session variable is set to and then get those language keys out of the database and display those. If there isn't a session variables set, then you can just default to English. Session variables are nice because they stick around until the person closes their browser.
__________________
I am Addicted to Linux!
King is offline   Reply With Quote
Old Sep 22nd, 2007, 2:12 AM   #3
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,038
Rep Power: 5 lectricpharaoh will become famous soon enough
I'd recommend using cookies instead of session variables. This way, if the server process gets recycled (which sometimes happens), you don't lose this information. A larger benefit is that the information can persist between sessions; personally, web sites that ask me to pick a language (Canada being bilingual) and/or postal code on each visit quickly become annoying.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming Contest Site - Feedback Appreciated Shane Coder's Corner Lounge 0 Jan 22nd, 2007 5:02 AM
Site works in Firefox but not IE smoked_out_haze HTML / XHTML / CSS 8 Oct 27th, 2005 3:51 AM
Rereouting site through php. ghost_stalker PHP 28 Sep 20th, 2005 2:20 PM
extracting info from a remote site. scorpiosage PHP 1 Jul 8th, 2005 4:41 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:40 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC