![]() |
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! |
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'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.
|
| All times are GMT -5. The time now is 3:08 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC