I have created and manage a bilingual website. To date, I have used a session using a GET lang variable and included a lang file based on that. My lang file is a simple php array with keys of home_h1, home_p1
for example and then the text as the values.
It makes my actual pages look very clean and short, and I have had no problems maintaining it, as I can typically translate the English into Spanish myself, and just change the other lang file. (The keys are obviously the same in both files)
I don't have time to maintain this anymore. So I want to build a CMS for a translator to work with. They will be editing both languages at once hopefully. The plan is to have a database table with keys: id, description, page, paragraph_no, English, Spanish
. How can I keep my current system but use the new DB table with my CMS? Can I use php to write a new php file that contains an array with the description key (must the description be the primary key?) and the English/Spanish translation, and so matches my current format?
All I would have to do is replace the new lang files in the appropriate directory. I have never written files using php so this is new to me. I am totally open to other suggestions too this is just what I thought would be fastest (And by the way I don't want to use queries to get the texts I think there are too many on my site, and I would assume an array in an included file is much faster.
-- edit --
I have been researching this on stackoverflow, and someone mentioned using the method I have just outlined, writing php files and then including them, but the answer lacked how, which is what I don't know. I am learning php on an as needed basis and stack overflow is my library, along with the php library of course. Thanks!