johnnyb
01-19-2008, 12:53 AM
Hi,
I have a website, written in PHP/MySQL, that I need to add support for multiple languages to. There isn't a lot of text on it, mostly a bunch of short sentences and phrases, so I don't want to make a copy of all of the files, I'd just like to have a setting, probably a session variable, that stores the current display language, and based on the value of that variable output the page in the correct language.
What are everyone's opinions on the best way to do this, (at least everyone who cares to contribute)?
Should I dump all of my text into an include file and assign it to variables or constants - then just include the file for the correct language? (This is how oscommerce does it).
Should I store all the text in a DB table "LANGUAGE" or something and only retrieve the stuff I need for a particular page? (this gives me easier storage for some info, and I don't have to worry about manually escaping stuff the same way, but it makes it harder to edit the text).
Are there other options? I want to create a system that is scalable so that languages can be added or removed easily.
Thanks in advance for the input!
John
I have a website, written in PHP/MySQL, that I need to add support for multiple languages to. There isn't a lot of text on it, mostly a bunch of short sentences and phrases, so I don't want to make a copy of all of the files, I'd just like to have a setting, probably a session variable, that stores the current display language, and based on the value of that variable output the page in the correct language.
What are everyone's opinions on the best way to do this, (at least everyone who cares to contribute)?
Should I dump all of my text into an include file and assign it to variables or constants - then just include the file for the correct language? (This is how oscommerce does it).
Should I store all the text in a DB table "LANGUAGE" or something and only retrieve the stuff I need for a particular page? (this gives me easier storage for some info, and I don't have to worry about manually escaping stuff the same way, but it makes it harder to edit the text).
Are there other options? I want to create a system that is scalable so that languages can be added or removed easily.
Thanks in advance for the input!
John