![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Oct 2005
Posts: 54
Rep Power: 4
![]() |
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! |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 377
Rep Power: 0
![]() |
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! |
|
|
|
|
|
#3 |
|
Caffeinated Neural Net
![]() Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,038
Rep Power: 5
![]() |
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 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |