gabian Posted April 14, 2011 Share Posted April 14, 2011 Hello everybody, I’ve studied this book and ask a few questions a couple of month ago, in the other forum. The book proved very useful and the php I’m writing improved immensely. However I’m building now my own site and I would like to be able to shift between two languages: Spanish and English. I’m thinking about using 2 database connections but I’m not very sure how to do it. (in the public zone, and in the staff zone) Can you give me a general idea? In a couple of days or so I will receive your MySQL second edition, where from I’m hoping to get some more ideas. Thank you in advance for your help. Link to comment Share on other sites More sharing options...
Larry Posted April 15, 2011 Share Posted April 15, 2011 Thanks for the nice words on the book. Sometimes you can create two database connections by assigning them to two different variables. However, database connections are expensive, in terms of server resources, so I'd recommend finding a different way. For example, you can use one connection but switch databases as needed. Link to comment Share on other sites More sharing options...
Jonathon Posted April 15, 2011 Share Posted April 15, 2011 It may not be any use to you, but google have a widget that is pretty easy to install. It's a 1 click jobby that translates your pages. I don't know how accurate it is, your probably the best judge for that. Link to comment Share on other sites More sharing options...
tryingtolearn Posted April 16, 2011 Share Posted April 16, 2011 Going off the assumption that you will be inputting the two different languages and not just translating the page text maybe something like this would work. 1 database set up like this [table] lang-- id -- name [table] page -- id [table] page_lang -- id -- page_id -- language_id -- title -- content Then you have the user select their language and assign that ID to a session so it pulls the correct language title and content for the page. Seems like it would be the easiest to maintain and expand if you need to add another language. Just a thought. 2 Link to comment Share on other sites More sharing options...
Recommended Posts